include stdio int one 81 two 81 int int geta void int getb void int ma

 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
58
59
60
61
#include <stdio.h>
int one[81], two[81];
int p,k;
int geta(void);
int getb(void);
int main (void)
{
int n, j, i, r[81];
scanf ("%d\n", &n);
if (n==0) return 0;
j=0;
while (n--)
{
j++;
for (i=0; i<81; i++)
one[i]=two[i]=r[i]=0;
k=0;
geta();
k=0;
getb();
for (i=80; i>0; i--)
{
if ((one[i]+two[i]+r[i])==1) r[i]=1;
else if ((one[i]+two[i]+r[i])==2) {r[i]=0; r[i-1]=1;}
else if ((one[i]+two[i]+r[i])==3) {r[i]=1; r[i-1]=1;};
}
printf ("%d ", j);
for (i=0; i<81, r[i]==0; i++);
if (i==81) printf ("%d", 0);
for (; i<81; i++)
printf ("%d", r[i]);
printf ("\n");
}
return 0;
}
int geta (void)
{char c, r=0;
while ((!r)&&((c=getchar())!=' ')&&(c!='\n'))
{
r=geta();
one[80-k]=c-48;
k++;
}
return 1;
}
int getb (void)
{char c, r=0;
while ((!r)&&((c=getchar())!=' ')&&(c!='\n'))
{
r=getb();
two[80-k]=c-48;
k++;
}
return 1;
}