백준 2292번: 벌집 #Python

ColorlessDia·2025년 6월 13일

algorithm/baekjoon

목록 보기
572/807
N = int(input())

if N == 1:
    print(1)
else:
    a = 1
    b = 1
    i = 1

    while 1:
        c = i * 6
        b += c
        a = (b - c + 1)

        if a <= N <= b:
            break
        
        i += 1

    print(i + 1)

0개의 댓글