Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problema 122
- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,ca1=0,cb1=0,c,d;
- cin>>a>>b;
- c=a;
- d=b;
- while (a!=0){
- if (a%2==1)
- ca1++;
- a=a/2;
- }
- while (b!=0){
- if (b%2==1)
- cb1++;
- b=b/2;
- }
- if (ca1==cb1)
- if (c<d)
- cout<<c;
- else
- cout<<d;
- else
- if (ca1>cb1)
- cout<<c;
- else
- cout<<d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement