-
Total time limit:
-
1000ms
-
Memory Limit:
-
65536kB
-
Describe
-
The number of non-negative integers of two not exceeding 200 bits is obtained.
-
Input
-
There are two lines, each of which is a non-negative integer that does not exceed 200 bits, and may have extra leading 0.
-
Output
-
A row, which is the result after the addition. The result can not have redundant leading 0, that is, if the result is 342, then you cannot output to 0342.
-
Sample input
-
2222222222222222222233333333333333333333
-
Sample output
-
55555555555555555555
-
Source
-
Program Design Internship
The code is actually:
1#include <cstdio>2#include <cstring>3 intLA,LB,LC;4 inta[ About],b[ About],c[ About];5 Charcha[ About],chb[ About];6 intMain () {7scanf"%s%s",&cha,&ChB);8La=strlen (CHA); lb=strlen (CHB);9 for(intI=0; i<la;i++) a[i]=cha[la-i-1]-'0';Ten for(intI=0; i<lb;i++) b[i]=chb[lb-i-1]-'0'; OneLc=LA; A if(LB>LC) lc=lb; - for(intI=0; i<lc;i++){ -c[i]+=a[i]+B[i]; the if(c[i]>9){ -c[i+1]++; -c[i]%=Ten; - if(i+1==LC) lc++; + } - } + while(!c[lc]&&lc>0) lc--; A for(inti=lc;i>=0; i--) printf ("%d", C[i]); atprintf"\ n"); - return 0; -}
。。。
Large integer Addition