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 |
不知道那里错了阿 谁帮我看下阿#include<iostream> using namespace std; struct large { int i; int j; }; int mian() { int n; while(cin>>n) { large*m=new large[n]; int *x=new int [n]; for(int i=0;i<n;i++) cin>>m[i].i>>m[i].j; int l=0,j=1,sum=0; for(i=n-1;i>=0;i--) { x[i]=m[i].i+m[i].j+l; if(x[i]>9) { l=1; x[i]%=10; } else { l=0; } sum+=x[i]*j; j*=10; if(i==0&&l==1) sum=sum+l*j; } cout<<sum<<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