当前位置:网站首页>[51nod p3216] Award [bit operation]
[51nod p3216] Award [bit operation]
2022-06-13 09:35:00 【Ayane.】
analysis :
Medals are all 2 2 2 The power of So I just ask how many binary numbers there are for each number 1 1 1
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int n,x;
int main(){
scanf("%d",&n);
while(n--)
{
int ans=0;
scanf("%d",&x);
while(x)
{
ans+=(x&1);
x>>=1;
}
printf("%d\n",ans);
}
return 0;
}
边栏推荐
- List list
- acwing 786. Number k
- C language: summary of question brushing (1)
- Instruction level parallelism (?)
- Tree and binary tree: storage structure of binary tree
- Exercise 7-10 finding specified characters (15 points)
- C/s model and P2P model
- Collection of articles on virtualization and cloud computing
- Spectre record
- LeetCode 6098. 统计得分小于 K 的子数组数目(前缀和+二分查找)
猜你喜欢
turtle库的使用数字时钟模拟时钟动态显示
Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
C language: deep understanding of character functions and string functions (1)
Tree and binary tree: basic operation and implementation of binary tree
Classes and objects -- object model and this pointer
acwing 788. Number of pairs in reverse order
turtle库显示系统时间
Trees and binary trees: the concept of binary trees
(bfs) acwing 847. Hierarchy of points in the graph
【pytorch环境安装搭建】
随机推荐
Classes and objects -- Inheritance
批量讀取文件夾下的全部語音文件
VGA常用分辨率及计算方法
LeetCode 201. 数字范围按位与
C language: Address Book
Haproxy + keepalived for high availability load balancing of MySQL
批量读取文件夹下的全部语音文件
Dpdk timer learning notes
Online debugging tool Arthas Foundation
JS【中高级】部分的知识点我帮你们总结好了
删除软链接
LeetCode 6095. Strong password checker II
Tree and binary tree: basic operation and implementation of binary tree
(dfs+ tree DP) acwing 846 Center of gravity of tree
C language: five custom types
C language: data storage in memory
C language: deep understanding of character functions and string functions (1)
HAProxy + Keepalived实现MySQL的高可用负载均衡
SQL ROW_ The number() function uses
Collection of articles on virtualization and cloud computing