大数加法
给出2个大整数A,B,计算A+B的结果。
Input
第1行:大数A 第2行:大数B (A,B的长度 <= 10000 需注意:A B有可能为负数)
Output
输出A + B
Sample Input
68932147586
468711654886
Sample Output
537643802472
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
void add(string a,string b)
{
int x=a.length(),y=b.length(),t=0;
string c;
while(x>0||y>0)
{
if(x)
t+=a[--x]-'0';
if(y)
t+=b[--y]-'0';
c.push_back(t%10+'0');
t/=10;
}
if(t)
c.