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 |
#include <iostream> #include <cstring> #include <cstdio> #include <string> #include <algorithm> using namespace std; int gcd(int a,int b) { if(a%b==0) return b; else return gcd(b,a%b); } int main() { int t,kase=1,num1,num2; string s1,s2; // cin>>num1>>num2; // cout<<gcd(num1,num2)<<"\n"; cin>>t; while(t--) { cin>>s1; cin>>s2; num1=0; num2=0; int prev=1; for(int i=s1.size()-1;i>=0;i--) { num1=num1+(s1[i]-'0')*prev; prev*=2; } prev=1; for(int i=s2.size()-1;i>=0;i--) { num2=num2+(s2[i]-'0')*prev; prev*=2; } //cout<<gcd(num1,num2)<<"\n"; if(gcd(num1,num2)==1) cout<<"Pair #"<<kase++<<": Love is not all you need!\n"; else cout<<"Pair #"<<kase++<<": All you need is love!\n"; } return 0; } |