forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1.py
More file actions
14 lines (11 loc) ยท 588 Bytes
/
1.py
File metadata and controls
14 lines (11 loc) ยท 588 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
n = int(input())
data = list(map(int, input().split()))
data.sort()
result = 0 # ์ด ๊ทธ๋ฃน์ ์
count = 0 # ํ์ฌ ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจํ๊ฐ์ ์
for i in data: # ๊ณตํฌ๋๋ฅผ ๋ฎ์ ๊ฒ๋ถํฐ ํ๋์ฉ ํ์ธํ๋ฉฐ
count += 1 # ํ์ฌ ๊ทธ๋ฃน์ ํด๋น ๋ชจํ๊ฐ๋ฅผ ํฌํจ์ํค๊ธฐ
if count >= i: # ํ์ฌ ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจํ๊ฐ์ ์๊ฐ ํ์ฌ์ ๊ณตํฌ๋ ์ด์์ด๋ผ๋ฉด, ๊ทธ๋ฃน ๊ฒฐ์ฑ
result += 1 # ์ด ๊ทธ๋ฃน์ ์ ์ฆ๊ฐ์ํค๊ธฐ
count = 0 # ํ์ฌ ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจํ๊ฐ์ ์ ์ด๊ธฐํ
print(result) # ์ด ๊ทธ๋ฃน์ ์ ์ถ๋ ฅ