Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- int main()
- {
- unsigned ll t;
- scanf("%I64d",&t);
- while(t--)
- {
- unsigned ll i=0,n,x,m=999999999999999999;
- scanf("%I64d",&n);
- for(i=0;i<61;i++)
- {
- x=abs(n-pow(2,i));
- m=min(m,x);
- }
- cout<<m<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment