Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. int32_t main(){
  2.     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  3. int n;
  4.     int c; cin >> c >> n;
  5.     int x = c >> n;
  6.     if((x&1) != ((x>>1)&1)){
  7.        if(x&1) cout << c + (1<<n) << '+';
  8.        else cout << c - (1<<n) << '-';
  9.     }else cout << c;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement