【华为OJ】【015-求int型数据在内存中存储时1的个数】
题目链接:
https://blog.csdn.net/DERRANTCM/article/details/51319753
C++实现:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16void main() { int n1,n2,n3,n4; string str1,strOut; cin >> n1; n2 = 0; while(n1 != 0) { n2 += n1 & 0x01; n1 >>= 1; } cout << n2 << endl; system("pause"); }
最后
以上就是顺心黑米最近收集整理的关于华为oj 015【华为OJ】【015-求int型数据在内存中存储时1的个数】的全部内容,更多相关华为oj内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复