Skip to content

Commit b9241e9

Browse files
committed
[Bronze II] Title: 벌집, Time: 36 ms, Memory: 32412 KB -BaekjoonHub
1 parent 6399a59 commit b9241e9

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# [Bronze II] 벌집 - 2292
2+
3+
[문제 링크](https://www.acmicpc.net/problem/2292)
4+
5+
### 성능 요약
6+
7+
메모리: 32412 KB, 시간: 36 ms
8+
9+
### 분류
10+
11+
수학
12+
13+
### 제출 일자
14+
15+
2025년 2월 18일 11:53:57
16+
17+
### 문제 설명
18+
19+
<p style="text-align: center;"><img alt="" src="https://www.acmicpc.net/JudgeOnline/upload/201009/3(2).png" style="height:397px; width:363px"></p>
20+
21+
<p>위의 그림과 같이 육각형으로 이루어진 벌집이 있다. 그림에서 보는 바와 같이 중앙의 방 1부터 시작해서 이웃하는 방에 돌아가면서 1씩 증가하는 번호를 주소로 매길 수 있다. 숫자 N이 주어졌을 때, 벌집의 중앙 1에서 N번 방까지 최소 개수의 방을 지나서 갈 때 몇 개의 방을 지나가는지(시작과 끝을 포함하여)를 계산하는 프로그램을 작성하시오. 예를 들면, 13까지는 3개, 58까지는 5개를 지난다.</p>
22+
23+
### 입력
24+
25+
<p>첫째 줄에 N(1 ≤ N ≤ 1,000,000,000)이 주어진다.</p>
26+
27+
### 출력
28+
29+
<p>입력으로 주어진 방까지 최소 개수의 방을 지나서 갈 때 몇 개의 방을 지나는지 출력한다.</p>
30+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
n = int(input())
2+
num, cnt = 1, 1
3+
while n > num:
4+
num += 6 * cnt
5+
cnt+=1
6+
print(cnt)

0 commit comments

Comments
 (0)