文章

19

粉丝

67

获赞

29

访问

11.5k

头像
C++常规解法
P1008 华南师范大学/贵州大学机试
发布于2023年8月6日 12:52
阅读数 500

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int count1 = 0;
	while (n != 0)
	{
		if (n % 2 == 1)
			count1++;
		n /= 2;
	}
	cout << "count0=" << 32 - count1 << " count1=" << count1;
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发