Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪位高人能帮我看看为什么WA?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator