본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 15035번 I Work All Day

by 현장 2024. 1. 19.

-Code

n = int(input())
h_list = list(map(int, input().split()))
tree_h = int(input())
min_tree = 3000
res = 500

for h in h_list:
    if min_tree > tree_h % h:
        min_tree = tree_h % h
        res = h

print(res)