본문 바로가기

IT Study/Algorithm

[백준 알고리즘]2292번 벌집



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
 
int main(void)
{
    int N;
 
    scanf("%d",&N);
    
    int cnt=1;
    int value=1;
    while(1){
        if(value<N){
            value+= cnt*6;
            cnt++;
        }
        else
            break;
    }
 
    printf("%d",cnt);
    return 0;
}
 
cs


'IT Study > Algorithm' 카테고리의 다른 글

NN단 (binarySearch 문제)  (0) 2018.08.29
[백준 알고리즘]1011번 Fly me to the Alpha Centauri  (0) 2018.08.21
[백준 알고리즘]4880번 다음수  (0) 2018.08.21
암호화와 복호화  (0) 2018.05.17
진수 변환 코드  (0) 2018.05.17