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 |
Re:HELP,牛人们.WA啊!!In Reply To:Re:HELP,牛人们.WA啊!! Posted by:weitao at 2008-05-31 19:08:00 #include <stdio.h> #include<string.h> int main(int argc, char *argv[]) { char s[22],c[22],d[22]; int i,j,sum,Len,NLen,w,x,z; while(scanf("%s",s)!=EOF) { Len=strlen(s); j=0; for(i=0;i<Len;i++) { if(s[i]=='B'||s[i]=='F'||s[i]=='P'||s[i]=='V') { c[j]=1; j++; } else if(s[i]=='C'||s[i]=='G'||s[i]=='J'||s[i]=='K'||s[i]=='Q'||s[i] =='S'||s[i]=='X'||s[i]=='Z') { c[j]=2; j++; } else if(s[i]=='D'||s[i]=='T') { c[j]=3; j++; } else if(s[i]=='L') { c[j]=4; j++; } else if(s[i]=='M'||s[i]=='N') { c[j]=5; j++; } else if(s[i]=='R') { c[j]=6; j++; } else continue; } c[j]='\0'; NLen=strlen(c); z=0; w=0; while(c[w]!='\0') { d[z]=c[w]; z++; for(x=w+1;x<NLen;x++) { if(c[w]==c[x]) continue; else {w=x; break;} } } d[z]='\0'; printf("%s\n",d); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator