[Baekjoon] 2292. 벌집

mj·2024년 4월 24일
0

코딩테스트문제

목록 보기
3/50

2292. 벌집

< 규칙 >

  • 1 (1개)
  • 2 3 4 5 6 7 (6개)
  • 8 9 10 11 12 13 14 15 16 17 18 19 (12개)
  • 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 (18개)
  • ... (24개)



🔍 내 답

n = int(input())

if n==1:
    ans = 1
else:

    mul = 1
    start = 2

    while True:
        end = start + mul*6

        if start <= n < end:
            ans = mul + 1
            break
            
        start = end
        mul += 1
    

print(ans)
profile
일단 할 수 있는걸 하자.

0개의 댓글