The bored Three-God get another boring question.
This problem is ask you plus two big nubmer, please help him, when you solve thisproblem you can
speak to Three-God,"Oh, Please give me a diffculte one, this oneis too easy".
1 1 2 3 10000 100000
2 5 110000
输入时候有前导0,输出时必须也有……
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<string>
#include<math.h>
#include<map>
#include<queue>
#include<stack>
#define INF 0x3f3f3f3f
#define ll long long
#define For(i,a,b) for(int i=a;i<b;i++)
#define sf(a) scanf("%d",&a)
#define sff(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
int x[10005],y[10005],z[10005];
char a[10005],b[10005];
int main()
{
while(~scanf("%s%s",a,b))
{
mem(z,0);
mem(x,0);
mem(y,0);
int aa=strlen(a);
int bb=strlen(b);
int p=0;
for(int i=aa-1; i>=0; i--)x[p++]=a[i]-'0';
p=0;
for(int i=bb-1; i>=0; i--)y[p++]=b[i]-'0';
int d=0;
p=max(aa,bb);
for(int i=0;i<=p; i++)
{
int s=x[i]+y[i]+d;
z[i]=s%10;
d=s/10;
}
if(z[p])printf("%d",z[p]);
// int flag=-1;
// for(int i=50004; i>=0; i--)
// if(z[i])
// {
// flag=i;
// break;
// }
for(int i=p-1; i>=0; i--)
printf("%d",z[i]);
printf("\n");
}
}