当前位置:网站首页>[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;
}
边栏推荐
- Timestamp to localdate
- Class template
- LeetCode 5289. Fair distribution of cookies (DFS)
- Simple use of spiel expressions
- Opencv face recognition of ros2 foxy~galactic~humble
- VGA common resolution and calculation method
- 202012 CCF test questions
- LeetCode 6098. 统计得分小于 K 的子数组数目(前缀和+二分查找)
- LeetCode 72. 编辑距离
- C language: deep understanding of pointers and arrays
猜你喜欢

Overview of common layers of image recognition neural network (under update)

(state compression dp+ binary) acwing 91 Shortest Hamilton path

(dfs+ pruning + checkerboard problem +dood) acwing 843 N-queen problem

Alibaba senior experts analyze the standard design of protocol

turtle库显示系统时间

Tree and binary tree: application of binary tree traversal

(dp+ memory) acwing 901 skiing

C language: deep understanding of character functions and string functions (1)

Online debugging tool Arthas advanced

C language: recursive function to realize Hanoi Tower
随机推荐
acwing 788. Number of pairs in reverse order
LeetCode 343. integer partition
C/s model and P2P model
Classes and objects - initialization and cleanup of objects
Routing - static routing
Timestamp to localdate
VDD, dvdd, avdd, VCC, afvdd, dovdd, iovdd
acwing 786. Number k
acwing 789. Range of numbers (dichotomy + suitable for understanding dichotomy boundary)
马斯克的「元宇宙」梦
SpEL表达式 简单使用
Opencv face recognition of ros2 foxy~galactic~humble
C language: callback function
I have summarized the knowledge points of JS [intermediate and advanced] for you
1-2 24:00 (20 points) [CSP certification true question]
C language: dynamic memory management
C language: minesweeping
全新BMW i3的操控,能符合对3系之名产品的期待吗?
LeetCode 1. Sum of two numbers
(dfs+ pruning + checkerboard problem +dood) acwing 843 N-queen problem

