Skip to content

Commit d05fd74

Browse files
committed
[BOJ] 13458 시험 감독 (B2)
1 parent 02fc5b4 commit d05fd74

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

심수연/7주차/260211.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# https://www.acmicpc.net/problem/13458
2+
3+
import sys
4+
input = sys.stdin.readline
5+
6+
N = int(input()) # 시험장의 개수 5
7+
A = list(map(int, input().split())) # 각 시험장에 있는 응시자의 수 [10, 9, 10, 9, 10]
8+
B, C = list(map(int, input().split())) # 7 20 | B: 총감독관이 한 시험장에서 감시할 수 있는 응시자의 수. # C: 부감독관이 한 시험장에서 감시할 수 있는 응시자의 수.
9+
# 총감독관은 오직 1명만 있어야 하고, 부감독관은 여러 명 있어도 된다.
10+
# 각 시험장마다 응시생을 모두 감독하기 위해 필요한 감독관의 최소 수는?
11+
12+
count = 0
13+
# 총감독관 수는 N명
14+
# 부감독관 수는 (A[i]-B) % C가 0이면 (A[i]-B) // C , 0이 아니면 (A[i]-B) // C + 1
15+
# 최종: 총감독관 수(= N) + 부감독관 수 count
16+
17+
# B = 7, C가 20일 때
18+
# 10 이면 3 // 20 -> 0 -> +1
19+
# 9 면 2 // 20 -> 0 -> +1
20+
for i in range(N):
21+
if A[i]-B < 0: # A[i] - B가 음수일 때
22+
sub = 0
23+
elif (A[i]-B) % C == 0:
24+
sub = (A[i]-B) // C
25+
else:
26+
sub = (A[i]-B) // C + 1
27+
count += sub
28+
29+
print(count + N)

0 commit comments

Comments
 (0)