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 |
用cin没问题,贴AC代码In Reply To:cin和gets会错, 要换成scanf输入!!!!! Posted by:20092462 at 2010-06-05 15:18:06 #include <iostream> #include <string> using namespace std; int main() { string a; int *q,d,i; cin>>a; d=a.length(); q=new int[d]; memset(q,0,4*d); do { for (i=0;i<d;i++) { q[i]+=a[i]-48; q[i]%=10; } } while (cin>>a); for (i=0;i<d;i++) cout<<q[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