Pair #1: All you need is love! Pair #2: Love is not all you need! Pair #3: Love is not all you need! Pair #4: All you need is love! Pair #5: All you need is love!
intto_dec(string); boolgcd(int, int); intmain(){ fastio; int n, n1, n2; string s1, s2; bool suc; cin >> n; for(int c = 1; c <= n; ++c){ cin >> s1 >> s2; n1 = to_dec(s1); n2 = to_dec(s2); suc = gcd(n1, n2); cout << "Pair #" << c << ": "; if(suc) cout << "All you need is love!\n"; else cout << "Love is not all you need!\n"; } } intto_dec(string s){ int sum = 0; for(int i = 0; i < s.length(); ++i){ sum = sum * 2 + (s[i] - '0'); } return sum; } boolgcd(int a, int b){ while(a != 0 && b != 0){ if(a > b) a = a % b; else b = b % a; } if(max(a, b) == 1) returnfalse; returntrue; }