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

我的怎么总是wa啊 例子通过了

Posted by this_is_roy at 2005-01-30 13:07:19 on Problem 1002
#include<iostream>

using namespace std;

int main()
{
	char temp[20];
	bool flag(false);
	int count,i,j,k;
	char* num = new char[10000000];
	for(i=0;i<10000000;i++)
		num[i]=0;
	cin>>count;
	cin.getline(temp,20);
	while(count--)
	{
		cin.getline(temp,20);
		for(i=0,j=1000000,k=0;temp[i]!=0;i++)
		{
			switch(temp[i]){

			case '-':
				break;
			case '0':
				j/=10;
				break;
			case '1':
				k+=j;
				j/=10;
				break;
			case '2':
			case 'A':
			case 'B':
			case 'C':
			case 'a':
			case 'b':
			case 'c':
				k+=2*j;
				j/=10;
				break;
			case '3':
			case 'D':
			case 'E':
			case 'F':
			case 'd':
			case 'e':
			case 'f':
				k+=3*j;
				j/=10;
				break;
			case '4':
			case 'G':
			case 'H':
			case 'I':
			case 'g':
			case 'h':
			case 'i':
				k+=4*j;
				j/=10;
				break;
			case '5':
			case 'J':
			case 'K':
			case 'L':
			case 'j':
			case 'k':
			case 'l':
				k+=5*j;
				j/=10;
				break;
			case '6':
			case 'M':
			case 'N':
			case 'O':
			case 'm':
			case 'n':
			case 'o':
				k+=6*j;
				j/=10;
				break;
			case '7':
			case 'P':
			case 'R':
			case 'S':
			case 'p':
			case 'r':
			case 's':
				k+=7*j;
				j/=10;
				break;
			case '8':
			case 'T':
			case 'U':
			case 'V':
			case 't':
			case 'u':
			case 'v':
				k+=8*j;
				j/=10;
				break;
			case '9':
			case 'W':
			case 'X':
			case 'Y':
			case 'w':
			case 'x':
			case 'y':
				k+=9*j;
				j/=10;
				break;
			default:
				break;}
		}
		num[k]++;
	}
	for(i=0;i<10000000;i++)
		if(num[i]>1) cout<<i/10000<<"-"<<i%10000<<" "<<(int)num[i]<<endl;
	delete[] num;
	return 0;
}

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