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 |
这……这……这是为么子啊??哪错了啊~~~做出来的大牛们看看~~貌似很多人都是这种情况呢~~~附代码~~跪谢了……#include <iostream> using namespace std; int main() { char str1[21],str2[21]; while(cin>>str1) { int top=-1,tag=0,len=strlen(str1); for(int i=0;i<len;i++) { if(str1[i]=='R') str2[++top]='6'; else if(str1[i]=='L') str2[++top]='4'; else if(str1[i]=='D'||str1[i]=='T') str2[++top]='3'; else if(str1[i]=='M'||str1[i]=='N') str2[++top]='5'; else if(str1[i]=='B'||str1[i]=='F'||str1[i]=='P'||str1[i]=='V') str2[++top]='1'; else if(str1[i]=='C'||str1[i]=='G'||str1[i]=='J'||str1[i]=='K'||str1[i]=='Q'||str1[i]=='X'||str1[i]=='S'||str1[i]=='Z') str2[++top]='2'; else { tag=1; } if(top>0&&str2[top]==str2[top-1]) { if(!tag) top--; else tag=0; } } str2[++top]='\0'; cout<<str2<<endl; } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator