小米oj 反向位整数

Posted dogenya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了小米oj 反向位整数相关的知识,希望对你有一定的参考价值。

模拟

 1 #define mm(a) memset(a,0,sizeof(a));
 2 #define max(x,y) (x)>(y)?(x):(y)
 3 #define min(x,y) (x)<(y)?(x):(y)
 4 #define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
 5 #define rep(i,a,b) for(int i=(a);i<=(b);i++)
 6 #define per(i,b,a) for(int i=(b);i>=(a);i--)
 7 #include<bits/stdc++.h>
 8 typedef long long ll;
 9 #define PII pair<ll,ll>
10 using namespace std;
11 const int INF=0x3f3f3f3f;
12 const int MAXN=(int)2e5 + 5;
13 const ll mod=1e9+7;
14 
15 
16 char s[MAXN];
17 unsigned int n;
18 
19 int main()
20 {
21     ll ans=0;
22     scanf("%u",&n);
23 
24     for(int i=0;i<32;i++){
25         ans<<=1;
26         if(n&(1<<i))ans|=1;
27     }
28     printf("%lld\n",ans);
29     return 0;
30 }

 

以上是关于小米oj 反向位整数的主要内容,如果未能解决你的问题,请参考以下文章