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 |
什么测试数据都试了就是A不了,大家帮忙看看,谢谢了~~#include<iostream> #include<string> using namespace std; int main() { //freopen("1.txt","r",stdin); char a[300]; int b[300][300]={0},i,j,m[300],n=0,c[300]={0},t;//本来开的103,怕过 //不了改300了 while(cin>>a&&strcmp(a,"0")) { i=0; while(a[i]!='\0'){ i++;} m[n]=i; for(i=m[n]-1;i>=0;i--) b[n][m[n]-1-i]=a[i]-'0'; n++; } for(i=0;i<103;i++) { t=0; for(j=0;j<n;j++) { t+=b[j][i]; } t+=c[i]; c[i+2]+=t/100; c[i+1]+=t/10; c[i]=t%10; } i=103; while(c[i]==0)i--; for(j=i;i>=0;i--) cout<<c[i]; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator