Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int bintodec(string s)
- {
- int l=s.length(), base=1, dec=0;
- for (int i=l-1; i>=0; i--) {
- if (s[i]=='1')
- dec+=base;
- base*=2;
- }
- return dec;
- }
- int main()
- {
- int n, t=1;
- scanf("%d", &n);
- while (n--) {
- string s1, s2;
- cin>>s1;
- cin>>s2;
- int x=bintodec(s1);
- int y=bintodec(s2);
- if (__gcd(x,y)==1)
- printf("Pair #%d: Love is not all you need!\n", t++);
- else
- printf("Pair #%d: All you need is love!\n", t++);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement