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 |
如果输入Z,A,Q,~的话,你的输出结果与题目要求不符In Reply To:哪位大牛帮我看一下这程序到底错哪了,先谢谢了!!! Posted by:scaneeling at 2008-07-29 13:26:32 改为如下就AC了O(∩_∩)O~ #include<iostream> #include<string> using namespace std; int main() { int i,j; char b[100]; char a[100]={'/', '.', ',', 'M', 'N', 'B', 'V', 'C', 'X','Z','\'', ';', 'L', 'K', 'J', 'H', 'G', 'F', 'D','S','A','\\', ']', '[', 'P', 'O', 'I', 'U', 'Y', 'T', 'R', 'E', 'W', 'Q','=', '-','0', '9', '8', '7', '6', '5', '4', '3','2','1','`'}; while(gets(b)) { for(i=0;i<strlen(b);i++) if(b[i]=='Z'||b[i]=='A'||b[i]=='Q'||b[i]=='`') continue; else { if(b[i]!=' ') { for(j=0;j<50;j++) { if(b[i]==a[j]) break; } cout<<a[j+1]; } else cout<<b[i]; } cout<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator