Advertisement
Farjana_akter

Untitled

Feb 13th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int binary(string n)
  4. {
  5. string s=n;
  6. //cout<<"string is "<<s<<endl;
  7. int i,j,a,sum=0,base=1;
  8. int len=s.length();
  9. for(i=len-1;i>=0;i--)
  10. {
  11. if(s[i]=='1')
  12. {
  13. sum+=base;
  14. }
  15. base=base*2;
  16. }
  17. // cout<<sum<<endl;
  18. return sum;
  19. }
  20. int main()
  21. {
  22. int t,i,j,k,a,b,c;
  23. string s1,s2;
  24. cin>>t;
  25. for(k=1;k<=t;k++){
  26. cin>>s1>>s2;
  27. a=binary(s1);
  28. b=binary(s2);
  29.  
  30. if(__gcd(a,b)==1)
  31. printf("Pair #%d: Love is not all you need!\n",k);
  32. else
  33. printf("Pair #%d: All you need is love!\n",k);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement