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 |
Help 帮忙解释一下这题有什么特别之处吗,为什么总是WA? #include<iostream.h> #include<string.h> void main() { int digit[12],move[12]; int i; i=0; char s[12]; cin.getline(s,12); int n=strlen(s); for (i=0;i<n;i++) digit[i]=s[i]-'0'; memset(move,0,sizeof(move)); while (cin.getline(s,12)) { for (i=0;i<n;i++) move[i]+=s[i]-'0'; } for (i=0;i<n;i++) { move[i]%=10; digit[i]+=move[i]; digit[i]%=10; } for (i=0;i<n;i++) cout<<digit[i]; cout<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator