-
Notifications
You must be signed in to change notification settings - Fork 0
/
10193.cpp
41 lines (34 loc) · 814 Bytes
/
10193.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
#include <cstdio>
#include <cstring>
using namespace std;
int gcd(int x, int y)
{
while ((x %= y) && (y %= x))
;
return x > y ? x : y;
}
int main(void)
{
char s1[33], s2[33];
int sum1, sum2, i, times, index;
scanf("%d\n", ×);
index = 0;
while (times--) {
scanf("%s %s", s1, s2);
sum1 = 1;
for (i = 1; i < strlen(s1); ++i) {
sum1 <<= 1;
sum1 += s1[i] == '1' ? 1 : 0;
}
sum2 = 1;
for (i = 1; i < strlen(s2); ++i) {
sum2 <<= 1;
sum2 += s2[i] == '1' ? 1 : 0;
}
if (gcd(sum1, sum2) > 1)
printf("Pair #%d: All you need is love!\n", ++index);
else
printf("Pair #%d: Love is not all you need!\n", ++index);
}
return 0;
}