当前位置:网站首页>[51nod P3210] binary statistics

[51nod P3210] binary statistics

2022-06-13 09:35:00 Ayane.

 Insert picture description here
l i n k link link

analysis :

Violence goes by easily

CODE:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int T,ans[35];
int main(){
    
	scanf("%d",&T);
	while(T--)
	{
    
		int x,cnt=0;
		scanf("%d",&x);
		while(x%2==0)
		{
    
			cnt++;
			x>>=1;
		}
		ans[cnt]++;
	}
	for(int i=0;i<=31;i++)
		printf("%d ",ans[i]);
	return 0;
}
原网站

版权声明
本文为[Ayane.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270530324166.html