-
Notifications
You must be signed in to change notification settings - Fork 0
/
424.cpp
57 lines (40 loc) · 909 Bytes
/
424.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<stdio.h>
#include<string.h>
/* Integer Inquiry - 424 */
main(){
int i,j,t;
char n[103],sum[103]={0};
sum[102] = '\0';
while(1)
{
n[103] = '\0';
for(i=0;i<103;i++)
n[i] = 0;
scanf("%s",n);
if(n[0] == '0')
break;
t = strlen(n)-1;
j = 102;
for(i=0;i<=t;i++)
n[i] -= 48;
for(i=t;i>=0;i--,j--)
{
n[j]^=n[i];
n[i]^=n[j];
n[j]^=n[i];
}
for(i=j;i<=102;i++)
sum[i] += n[i];
for(i=102;i>0;i--)
{
sum[i-1]+=sum[i]/10;
sum[i]%=10;
}
}
t = 0;
while(sum[t]==0)
t++;
for(i=t;i<=102;i++)
printf("%d",sum[i]);
puts("");
}