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 |
为什么测试了各种数据都是对的,但是提交的时候却还是Wrong呢???求大神帮助呀#include<iostream> using namespace std; int main() { char temp[100]; int sum[100]={0},i,s,j,k=0,t=0; while(cin>>temp,temp[0]!='0') { int m[100]={0}; for(i=0;temp[i]!='\0';i++); if(i>k) k=i; for(j=100-i,s=0;j<100;s++,j++) m[j]=temp[s]-48; for(j=99;j>99-k;j--) { sum[j]+=m[j]; if(j==100-k) break; if(sum[j]>=10) { sum[j]-=10; sum[j-1]+=1; } } for(i=0;i<100;i++) temp[i]='\0';t++; } for(i=100-k;i<100;i++) cout<<sum[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