[C language] work two of the 32-bit numbers (zhw version)

Dalin recently read some information on large numbers of computing, that is erudite, he's out of a simple addition of large numbers of students in the classroom to do the exercises, of course, we are more than a few two addends and long int can represent range. This can not help but let his students lost in thought, how to do it? Words do not come out of the final grade might be 59 points up. At this critical moment, there is a clever punk students to come forward, through careful observation, he found two positive integer numbers high sum, can these two positive integers are split into positive integers between two numbers low addition and carry operations. Through unremitting efforts, he managed to solve this question, Dalin won praise. Please learn from punk students also write a similar program to solve this problem.

#include <stdio.h>
#include <stdlib.h>

int main()
{
long int A1,A2,A3,A4,A5,A6,a1,a2,a3,a4,a5,a6,a,b,c,d,e,f;
scanf("%5d%5d%5d%5d%5d%5d",&A1,&A2,&A3,&A4,&A5,&A6);
scanf("%5d%5d%5d%5d%5d%5d",&a1,&a2,&a3,&a4,&a5,&a6);
a=a1+A1;
b=a2+A2;
c=a3+A3;
d=a4+A4;
e=a5+A5;
f=a6+A6;
if(f>=100000) f=f-100000,e=e+1;
if(e>=100000) e=e-100000,d=d+1;
if(d>=100000) d=d-100000,c=c+1;
if(c>=100000) c=c-100000,b=b+1;
if(b>=100000) b=b-100000,a=a+1;
printf("%d%d%d%d%d%d",a,b,c,d,e,f);
return 0;
}

[Although this can calculate the correct number, but it can not get out on the oj, Why? ]

Guess you like

Origin www.cnblogs.com/asher0608/p/11689494.html