Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(0), cin.tie(0);
- // freopen("wpainting.in", "r", stdin);
- int n, m;
- cin >> n >> m;
- int ans = 0;
- int val = 1;
- int bn = 0, bm = 0;
- if(n%2==1 && m%2==1){
- // cout << "HI" << '\n';
- ans+=val;
- bn=n;
- bm=m;
- n=(n+1)/2;
- m=(m+1)/2;
- // cout << n << ", " << m << '\n';
- val=val*4;
- while(n%2==0 && m%2==0 && bn!=n && bm!=m){
- // cout << "HI2" << '\n';
- ans+=val;
- bn=n;
- bm=m;
- n=(n+1)/2;
- m=(m+1)/2;
- // cout << n << ", " << m << '\n';
- val=val*4;
- }
- }
- cout << ans << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement