#include <stdio.h> #include <string.h> int main() { char a[1000] = {0}; char b[1000] = {0}; int A[1000] = {0}; int B[1000] = {0}; int C[1001] = {0}; int jinwei = 0; int t = 0; while (scanf("%s %s", &a, &b) != EOF) { int len1 = strlen(a); int len2 = strlen(b); int len = len1 > len2 ? len1 : len2; for (int i = 0; i < len1; i++) { A[i] = a[len1 - 1 - i] - '0'; } for (int j = 0; j < len2; j++) { B[j] = b[len2 - 1 - j] - '0'; } for (int i = 0; i <= len; i++) { t = A[i] + B[i] + jinwei; C[i] = t % 10; jinwei = t / 10; } while (C[len] == 0) { //处理前导0 if (len == 1) { break; } len--; } for (int i = len; i >= 0; i--) { printf("%d", C[i]); } printf("\n"); } }