Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=1002
The topic meaning: is the large integer addition.
What you did two years ago is purely a matter of tidying up.
1#include <stdio.h>2#include <string.h>3 4 #defineMax 10105 CharA[max], B[max];6 7 intMain ()8 {9 intI, K, S, C, T, Len1, len2;Tenscanf"%d", &T); One for(k =0; K < T; k++) A { - intA[max] = {0}, B[max] = {0}; -scanf"%s%s", &a, &b); theLen1 =strlen (a); -Len2 =strlen (b); - for(i =0; i < len1; i++) -A[i] = a[len1-i-1] -'0'; + for(i =0; i < len2; i++) -B[i] = b[len2-i-1] -'0'; +c =0; A for(i =0; i < Max; i++) at { -s = a[i] + b[i] +C; -A[i] = s%Ten; -c = S/Ten; - } -printf"Case %d:\n%s +%s =", K +1, A, b); in for(i = max-1; I >=0; i--) - { to if(A[i]) + Break; - } the for(; I >=0; i--) *printf"%d", A[i]); $printf"\ n");Panax Notoginseng if(K < T-1) -printf"\ n"); the } + return 0; A}
HDU 1002.A + B problem II problem Solving report