|
|
вернуться в форумWhy WA#2?????? Why WA#2?????? #include<stdio.h> int main(){ int* a=new int[1000005]; int* b=new int[1000005]; long n,c=0,d=0,e=0; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d %d",&a[i],&b[i]);} for(int i=1;i<=n;i++){ c=(c+a[i])*10; d=(d+b[i])*10;} c=c/10; d=d/10; e=c+d; printf("%d",e); } Re: Why WA#2?????? First: if you want to get number from digits you should write for (int i=1; i<=n; i++) { c = c*10 + a[i]; d = d*10 + b[i]; } Second: you can't get number from such amount of digits. You should sum given numbers by digits (столбиком). Edited by author 07.05.2009 02:03 Edited by author 07.05.2009 02:03 |
|
|