231. 시험 감독

아현·2021년 8월 2일
0

Algorithm

목록 보기
241/400

백준




1. Python


브루트 포스 (시간초과)


import sys
input = sys.stdin.readline

n = int(input())
data = list(map(int, input().split()))
b, c = map(int, input().split())

count = 0

for d in data:
    rest = d - b
    count += 1
    while rest > 0:
        count += 1
        rest -= c


print(count)



수학


import sys
input = sys.stdin.readline

n = int(input())
data = list(map(int, input().split()))
b, c = map(int, input().split())

count = 0

for i in range(n):
    if data[i] > 0:
        data[i] -= b
        count += 1

    if data[i] > 0:
        count += int(data[i]/c)

        if data[i] % c != 0:
            count += 1


print(count)

profile
Studying Computer Science

0개의 댓글