Advertisement
Zinak

Untitled

Sep 29th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. ll decimal(ll num)
  5. {
  6. ll temp=num,sum=0,b=0,d;
  7. while(temp!=0)
  8. {
  9. d=temp%10;
  10. temp/=10;
  11. sum+=d*pow(2,b);
  12. ++b;
  13.  
  14. }
  15. return sum;
  16. }
  17. int main()
  18. {
  19. ll T;
  20. cin>>T;
  21. int A,B,c,d;
  22. for(int i=0;i<T;i++)
  23. {
  24. cin>>A>>B;
  25. c=decimal(A);
  26. d=decimal(B); //cout<<c<<' '<<d<<endl;
  27. if(c==d)cout<<"Case "<<i+1<<": Same"<<endl;
  28. else if(c>d)cout<<"Case "<<i+1<<": A"<<endl; //Case 1: A
  29. else if(d>c)cout<<"Case "<<i+1<<": B"<<endl;
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement