Codeforces Round #516 (Div. 2, by Moscow Team Olympiad) B

Posted huluxin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #516 (Div. 2, by Moscow Team Olympiad) B相关的知识,希望对你有一定的参考价值。

 1 #include<bits/stdc++.h>
 2 
 3 int n,T,cnt;
 4 
 5 int read()
 6 {
 7     char ch = getchar();
 8     int num = 0;
 9     bool fl = 0;
10     for (; !isdigit(ch); ch=getchar())
11         if (ch==-) fl = 1;
12     for (; isdigit(ch); ch=getchar())
13         num = (num<<1)+(num<<3)+ch-48;
14     if (fl) num = -num;
15     return num;
16 }//快读 
17 int main()
18 {
19     T = read();
20     while (T--)
21     {
22         int n = read();
23         cnt = 0;
24         while (n)
25         {
26             cnt++;
27             n = n&(n-1);
28         }//获得二进制n当中1的个数 
29         printf("%d
",1<<cnt);//1向左移cnt位 
30     }
31     return 0;
32 }

 

以上是关于Codeforces Round #516 (Div. 2, by Moscow Team Olympiad) B的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #516 (Div. 2&&Div.1)

Codeforces Round #516 (Div. 2, by Moscow Team Olympiad)

Codeforces Round #516 (Div. 1) 题解

[Codeforces Round #516][Codeforces 1063B/1064D. Labyrinth]

Codeforces Round #516 Div2 D. Labyrinth

Codeforces Round #516 (Div. 1, by Moscow Team Olympiad) D