#include<iostream> #include<stdio.h> #include<string.h> using namespace std; char * add(char *a, char*b) { int la = strlen(a); int lb = strlen(b); char result[la+lb+2]; int p_r = 0; memset(result, 0, sizeof(result)); int crease = 0; while (la-- && lb--) { int tmp = int(a[la] - '0' + b[lb] - '0') + crease; result[p_r] = (tmp % 10) + '0'; crease = tmp / 10; p_r++; } while (la>=0) { int tmp = crease + int(a[la] - '0'); result[p_r] = (tmp%10) + '0'; crease = tmp/ 10; p_r++; la--; } while (lb>=0) { int tmp = crease + int(b[lb] - '0'); result[p_r] = (tmp%10) + '0'; crease = tmp/ 10; p_r++; lb--; } if ( crease > 0 ){ result[p_r] = crease + '0'; p_r++; } result[p_r]='