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 |
编译通过,运行时出错,不懂,帮我看看好吗?谢谢TT#include<stdio.h> #include<string.h> #define N 100000 #define N1 100 void main() { int n,i; char a[N][N1]; char change(char a[N][N1],int n); void compandpri(char a[N][N1],int n); scanf("%d",&n); for(i=0;i<n;i++) gets(a[i]); change(a,n); compandpri(a,n); } char change(char a[N][N1],int n) { char b[N][N1]; int i,j,t=0; for(i=0;i<n;i++) { t=0; for(j=0;;j++) while(a[i][j]!='\0') { if(a[i][j]=='A'||'B'||'C'){b[i][t]=2;t++;} if(a[i][j]=='D'||'E'||'F'){b[i][t]=3;t++;} if(a[i][j]=='G'||'H'||'I'){b[i][t]=4;t++;} if(a[i][j]=='J'||'K'||'L'){b[i][t]=5;t++;} if(a[i][j]=='M'||'N'||'O'){b[i][t]=6;t++;} if(a[i][j]=='P'||'R'||'S'){b[i][t]=7;t++;} if(a[i][j]=='U'||'T'||'V'){b[i][t]=8;t++;} if(a[i][j]=='W'||'X'||'Y'){b[i][t]=9;t++;} if(t==3) b[i][t]='-'; } a=b; return a; } } void compandpri(char a[N][N1],int n) { int b[N]={0}; int i,j,flag=0; for(i=0;i<n;i++) { for(j=0;j<0;j++) if((strcmp(a[i],a[j]))==0) b[i]++; } for(i=0;i<n;i++) { flag=0; for(j=0;j<n;j++) if(a[i]==a[j]) flag=1; if(flag==1) continue; else { if(b[i]>=2); printf("%s%d",a[i],b[i]); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator