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 |
我提交了个错误的程序,但是它AC了(附代码)#include<iostream> using namespace std; int main() { char a[20]; int b[20]; //char temp[20]; //cin>>temp; while (gets(a) != NULL) { int l=strlen(a); for(int n=0;n<l;n++) { //for(int j=0;j<20;j++)b[j]=0; //a[n]=temp[n]; if (a[n]=='L') b[n]=4; else if(a[n]=='R') b[n]=6; else if(a[n]=='D'||a[n]=='T') b[n]=3; else if(a[n]=='M'||a[n]=='N') b[n]=5; else if(a[n]=='B'||a[n]=='F'||a[n]=='P'||a[n]=='V') b[n]=1; else if(a[n]=='C'||a[n]=='G'||a[n]=='J'||a[n]=='K'||a[n]=='Q'||a[n]=='S'||a[n]=='X'||a[n]=='Z') b[n]=2; else b[n]=0; //if(b[n]==b[n-1]&&b[n]!=0) {b[n]=0;n--;} //if(b[0]!=0) printf("%d%s",b[0]," ") if(b[n]!=b[n-1] && b[n]!=0) printf("%d",b[n]); } cout<<endl; } system("pause"); return 0; } 当测试数据为CA;DDA;LLLA;MMMMA;RRRRRA时都是错的。。。求高手解释 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator