algorithm

더블릿|dovelet - 층 수 구하기/flr

블루건 2016. 7. 18. 16:19

문제


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <cmath>
 
int main()
{
    int n;
    std::cin >> n;
    int count = 1;
    int floor = 0;
    while (true)
    {    
        floor++;
        count *= 2;
        if (n < count)
        {
            std::cout << floor;
            break;
        }
    }
 
    return 0;
}
cs