Cough, I unkind, so, I wrote again ...
Source:
#include <stdio.h>
#include <string.h>
Char s1[1000];
int a[1000]={0},b[1000]={0},c[1000]={0};
int main ()
{
int i,j,z,l1,l2,l,o;
Freopen ("Hp-.in", "R", stdin);
Freopen ("Hp-.out", "w", stdout);
scanf ("%s", S1);
L1=strlen (S1);
for (i=0;i<=l1-1;i++)//convert S1 (meiosis) to a number and store in reverse a array
a[l1-1-i]=s1[i]-' 0 ';
scanf ("%s", S1);
L2=strlen (S1);
for (i=0;i<=l2-1;i++)//convert S1 (meiosis) to a number and deposit in reverse to B array
b[l2-1-i]=s1[i]-' 0 ';
if (L1==L2) {
for (j=l1;j>=0;j--)
{
if (A[j]>b[j])//a Large
{
o=0;
Break
}
if (B[j]>a[j])//b Large
{
O=1;
Break
}
}
}
if (l1>l2| | o==0)//a Big time
{
L=L1;
for (i=0;i<l;i++)
{
if (A[i]<b[i])
{
a[i]=a[i]+10;
A[i+1]-=1;
}
C[i]=a[i]-b[i];
}
while (l>1&&c[l-1]==0) l--; To give up the useless 0 in the high
for (i=l-1;i>=0;i--)//output
{
printf ("%d", c[i]);
}
}
Else
{
printf ("-");
L=L2;
for (i=0;i<l;i++)
{
if (A[i]>b[i])
{
b[i]=b[i]+10;
B[i+1]-=1;
}
C[i]=b[i]-a[i];
}
while (l>1&&c[l-1]==0) l--; To give up the useless 0 in the high
for (i=l-1;i>=0;i--)//output
{
printf ("%d", c[i]);
}
}
return 0;
}
from the group:
Chengdu Seven high-Tech campus OI2015 information Competition Ice Cane
http://www.cnblogs.com/chentao1c/--Ice Cane
2016/7/6 High Precision calculator-minus (Shen Gao precision)