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 |
太郁闷了,那位大牛给看看!!WA了n次#include<iostream> #include<string> using namespace std; int main() { string longint; static int a[103]={0}; int max=0; while(cin>>longint,longint!="0") { int n=longint.length(); for(int i=n-1,j=102;i>=0;i--,j--) { a[j]+=(int)longint[i]-48; if(a[j]>=10) { a[j]=a[j]%10; ++a[j-1]; if(a[j-1]==10) { a[j-1]=0; ++a[j-2]; } } } } for(int i=0;i<104;i++) { if(a[i]>0) { for(int j=i;j<103;j++) cout<<a[j]; cout<<endl; break; } else if(i==103) cout<<"0"<<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