Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- ll decimal(ll num)
- {
- ll temp=num,sum=0,b=0,d;
- while(temp!=0)
- {
- d=temp%10;
- temp/=10;
- sum+=d*pow(2,b);
- ++b;
- }
- return sum;
- }
- int main()
- {
- ll T;
- cin>>T;
- int A,B,c,d;
- for(int i=0;i<T;i++)
- {
- cin>>A>>B;
- c=decimal(A);
- d=decimal(B); //cout<<c<<' '<<d<<endl;
- if(c==d)cout<<"Case "<<i+1<<": Same"<<endl;
- else if(c>d)cout<<"Case "<<i+1<<": A"<<endl; //Case 1: A
- else if(d>c)cout<<"Case "<<i+1<<": B"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement