Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

超内存~~~~~~苦恼

Posted by kicker at 2003-10-10 23:19:41 on Problem 1002
#include<iostream.h>
#include<stdlib.h>
#include<iomanip.h>
#include<map>
#include<string.h>
using namespace std;


map<int,int> res;
map<int,int>::iterator miter;
char m[100];
int ok=0;

int main()
{
	char temp[100];
	m['1']='1';
	m['A']=m['B']=m['C']=m['2']='2';
	m['D']=m['E']=m['F']=m['3']='3';
	m['G']=m['H']=m['I']=m['4']='4';
	m['J']=m['K']=m['L']=m['5']='5';
	m['M']=m['N']=m['O']=m['6']='6';
	m['P']=m['R']=m['S']=m['7']='7';
	m['T']=m['U']=m['V']=m['8']='8';
	m['W']=m['X']=m['Y']=m['9']='9';
	m['0']='0';
	int i,cas,k,l,t;
	cin>>cas;
	for(i=0;i<cas;i++)
	{
		cin>>temp;
		l=0;
		for(k=0;k<7;k++)
		{
			while(temp[l]=='-')
				l++;
			temp[k]=m[temp[l]];
			l++;
		}
		temp[7]='\0';
		t=atoi(temp);

		res[t]++;
	}
	for(miter=res.begin();miter!=res.end();miter++){
		if(miter->second<2)
			continue;
		cout<<setfill('0')<<setw(3)<<miter->first/10000<<'-'<<setw(4)<<miter->first%10000<<' '<<miter->second<<'\n';
		ok=1;
	}
	if(ok==0)
		cout<<"No duplicates."<<'\n';
	return 1;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator