URAL_1048
高精度加法。
#include#include #define MAXD 1000010int a[MAXD], N;void solve(){ int i, x, y, s, c; for(i = 0; i < N; i ++) { scanf("%d%d", &x, &y); a[i] = x + y; } c = 0; for(i = N - 1; i >= 0; i --) { s = c + a[i]; c = s / 10; a[i] = s % 10; } for(i = 0; i < N; i ++) printf("%d", a[i]); printf("\n");}int main(){ while(scanf("%d", &N) == 1) { solve(); } return 0;}