```cpp
#include <bits/stdc++.h>
using namespace std;
int a[10005];
int b[10005];
int c[10020];
char s[10020],FLAG;
int str,K,k1=1;
void clean(int y[])
{
while(y[y[0]]==0&&y[0]>1)
y[0]--;
}
void IN(int x[])
{
int i;
gets(s);
str=strlen(s);
x[0]=str;
for(i=1;i<=str;i++)
x[i]=s[str-i]-'0';
clean(x);
}
int com(int x[],int y[])
{
int i;
if(x[0]>y[0]) return 1;
if(x[0]<y[0]) return 0;
for(i=x[0];i>0;i--)
{
if(x[i]>y[i])
return 1;
if(x[i]<y[i])
return 0;
}
return 2;
}
void begin(int x[],int y[])
{
int str,i;
str=max(x[0],y[0]);
c[0]=str;
if(K==0||K==2)
k1=K;
if(K==1||K==2)
{
for(i=1;i<=x[0];i++)
{
c[i]+=x[i]-y[i];
if(c[i]<0)
{
c[i]+=10;
c[i+1]--;
}
}
}
if(K==0)
{
for(i=1;i<=y[0];i++)
{
c[i]+=y[i]-x[i];
if(c[i]<0)
{
c[i]+=10;
c[i+1]--;
}
}
}
clean(c);
}
void out(int x[])
{
int i;
if(k1==0)
{
FLAG='-';
cout<<FLAG;
}
for(i=x[0];i>0;i--)
cout<<x[i];
}
int main()
{
IN(a);
IN(b);
K=com(a,b);
begin(a,b);
out(c);
return 0;
}
```
对不起,发的格式错了
by normal @ 2018-07-11 22:03:45
@[normal](/space/show?uid=57078) 请别用gets
by UKE自动稽 @ 2018-07-11 22:05:19
@[_UKE自动机_](/space/show?uid=71371) why??
by normal @ 2018-07-11 22:07:17
@[normal](/space/show?uid=57078) C++11把gets废除了,反正在这用gets会出现玄学错误
by UKE自动稽 @ 2018-07-11 22:11:54
非常感谢DL,ORZ
by normal @ 2018-07-11 22:14:08