摘要: 问题: 对于一个字节(8位)的无符号整型变量,求二进制中1的个数。 分析: 法一: (n%2)==1则二进制数n的最低位为1,用count记录下,接下来n减半; n/=2; (比如 11101001变为 01110100) 所以最基础版的代码如下: int GetAnswer1(unsigned c 阅读全文
posted @ 2020-06-28 15:27 sunshine_gzw 阅读(689) 评论(0) 推荐(0) 编辑