题目链接:http://codeforces.com/problemset/problem/579/A

 

这题目其实是个思维题!!!

 

首先我们想每个细菌扔到培养基里面数目就会增长一倍,所以如果是2的倍数的话我们就不用管

但是,如果是奇数的话,就说明需要扔一只细菌下去。

 

神他妈的知道为啥我会想到贪心和dp??

 

AC代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdbool>

using namespace std;


int main()
{
    int i,j,x,count=0;;
    scanf("%d",&x);
    while(x>1)
    {
        if(x%2==1)
        {
            count++;
        }
        x=x/2;
    }
    printf("%d\n",count+1);
    return 0;
}