1 /* 2 高精度加法 3 结构体初始化 4 重载赋值符号 加号 5 定义输出字符串函数用于输出流 6 重载输入输出流 7 */ 8 #include<bits/stdc++.h> 9 using namespace std; 10 const int maxn=10000; 11 struct bign{ 12 int d[maxn],len; 13 inline bign(){len=1;memset(d,0,sizeof(d));}; 14 inline bign operator = (const char* num) 15 { 16 memset(d,0,sizeof(d)); 17 len=strlen(num); 18 for(int i=0;i<len;i++) d[i]=num[len-i-1]-48; 19 return *this; 20 } 21 inline bign operator + (const bign &b) 22 { 23 int x=0,i,lenmax=max(len,b.len); 24 bign c;c.len=lenmax; 25 for(i=0;i<lenmax;i++) 26 { 27 c.d[i]=d[i]+x+b.d[i]; 28 x=c.d[i]/10; 29 c.d[i]%=10; 30 } 31 x?c.d[i]=x:i--; 32 c.len=i+1; 33 return c; 34 } 35 inline string str() const 36 { 37 char s[maxn]={}; 38 for(int i=0;i<len;i++) s[len-i-1]=d[i]+48; 39 return s; 40 } 41 }a,b; 42 inline istream& operator >> (istream &in,bign &x) 43 { 44 string s; 45 in>>s; 46 x=s.c_str(); 47 return in; 48 } 49 inline ostream& operator << (ostream &out,const bign &x) 50 { 51 out<<x.str(); 52 return out; 53 } 54 int main() 55 { 56 cin>>a>>b; 57 cout<<a+b; 58 return 0; 59 }