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 1097168451 at 2016-09-08 16:48:01 on Problem 1002
#include<iostream>
#include<string>
using namespace std;

int change(char t)
{
	switch(t)
	{
	case 'A':
	case 'B':
	case 'C': return 2;
	case 'D':
	case 'E':
	case 'F': return 3;
	case 'G':
	case 'H':
	case 'I': return 4;
	case 'J':
	case 'K':
	case 'L': return 5;
	case 'M':
	case 'N':
	case 'O': return 6;
	case 'P':
	case 'R':
	case 'S': return 7;
	case 'T':
	case 'U':
	case 'V': return 8;
	case 'W':
	case 'X':
	case 'Y': return 9;
	default:return t-'0';
	}
}

int times[9999999] = {0};

int main()
{
	char str[20];
	int ncase;
	int len = 0;
	int num = 0;
	scanf("%d",&ncase);

	for(int i=0;i<ncase;i++)
	{
		int temp = 0;
		scanf("%s",str);
		len = strlen(str);
		for(int j = 0;j<len;j++)
		{
			if((str[j]>='A'&&str[j]<='Z')||(str[j]>='0'&&str[j]<='9'))
				temp = temp*10+change(str[j]);
		}
		times[temp]++;
	}
	for(int i=0;i<9999999;i++)
	{
		if(times[i]>1)
		{
			num++;
			int temp = i;
			int p[7];
			for(int j=0;j<7;j++)
			{
				p[6-j] = temp%10;
				temp/=10;
			}
			for(int j=0;j<7;j++)
			{
				printf("%d",p[j]);
				if(j==2)
					printf("-");
			}
			printf(" %d\n",times[i]);
		}
	}
	if(num==0)
		printf("No duplicates.\n");
	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