Codeforces Round #320 (Div. 2) 579A. Raising Bacteria
来源:互联网 发布:windows反潜驱逐战 编辑:程序博客网 时间:2024/05/18 21:39
解题报告:Codeforces Round #320
You are a lover of bacteria. You want to raise some bacteria in a box.
Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hope to see exactly x bacteria in the box at some moment.
What is the minimum number of bacteria you need to put into the box across those days?
The only line containing one integer x (1 ≤ x ≤ 109).
The only line containing one integer: the answer.
5
2
8
1
For the first sample, we can add one bacterium in the box in the first day morning and at the third morning there will be 4 bacteria in the box. Now we put one more resulting 5 in the box. We added 2 bacteria in the process so the answer is 2.
For the second sample, we can put one in the first morning and in the 4-th morning there will be 8 in the box. So the answer is 1.
分析:求二进制中1的个数
- Codeforces Round #320 (Div. 2) 579A Raising Bacteria(脑洞)
- Codeforces Round #320 (Div. 2) 579A. Raising Bacteria
- Codeforces Round #320 (Div. 2) A. Raising Bacteria
- Codeforces Round #320 (Div. 2) A. Raising Bacteria
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round]A Raising Bacteria
- CodeForces 579A - Raising Bacteria
- CodeForces 579A Raising Bacteria
- codeforces 579A Raising Bacteria
- Raising Bacteria CodeForces - 579A
- Raising Bacteria (Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] )
- cf#320 Div.2 Problem A Raising Bacteria
- CodeForces 579A Raising Bacteria (水)
- Codeforces 579A. Raising Bacteria(位运算)
- Codeforces 320A - Raising Bacteria(思维)
- codeforces #320 div2A Raising Bacteria
- codeforces—— 579A —— Raising Bacteria
- coderforce 579A Raising Bacteria
- Codeforces Round #125 (Div. 1) A. About Bacteria
- 51nod 1181 质数中的质数(质数筛法)
- 51nod 1135 原根
- MySQL在Windows平台下忘记root密码的解决办法
- 硬币排成线 II
- C# SQLite 数据库开发(1)------数据库的下载、配置和操作
- Codeforces Round #320 (Div. 2) 579A. Raising Bacteria
- environment variables
- win7下搭建nfs-server的方法
- iOS开发优化tableView滑动流畅性的集中常用方法
- zoj2616 最小割
- Codeforces Round #321 (Div. 2) 580A. Kefa and First Steps
- 图片摆置.HTML
- 271 (Div. 2) A
- Androd学习笔记——[转]Android中Touch事件的处理逻辑