Skip to content

Commit 5f70283

Browse files
authored
Create 1.py
1 parent 461a371 commit 5f70283

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

11/1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
n = int(input())
2+
data = list(map(int, input().split()))
3+
data.sort()
4+
5+
result = 0 # 가능한 그룹의 수
6+
count = 0 # 그룹에 포함된 모험가의 수
7+
8+
for i in data: # 공포도를 낮은 것부터 하나씩 확인하며
9+
count += 1 # 그룹에 해당 모험가를 포함시키기
10+
if count >= i: # 모험가의 수가 현재의 공포도 이상이라면, 그룹 결성하여 여행 보내기
11+
result += 1 # 그룹의 수 증가시키기
12+
count = 0 # 그룹에 포함된 모험가의 수 초기화
13+
14+
print(result) # 그룹의 수 출력

0 commit comments

Comments
 (0)