|
|
back to boardWA on test 4 Can you help me to find mistake? #include <iostream> using namespace std; int a[100001]; long i,j,n,k,l; main(void){ scanf("%d",&n); for (i=1;i<=n;i++){ scanf("%d%d",&k,&l); a[i]=k+l; }; for (i=n;i>0;i--){ a[i-1]+=a[i]/10; a[i]=a[i] % 10; } if (a[0]>0) printf("%d",a[0]); for (i=1;i<=n;i++) printf("%d",a[i]); cout<<endl; }; Re: WA on test 4 n = 1000000, but you have a[100001]; |
|
|