python

5532 방학숙제

hauni 2025. 5. 14. 01:41

 

 

l = int(input())  # 방학 일수
a = int(input())  # 국어 페이지
b = int(input())  # 수학 페이지
c = int(input())  # 하루에 푸는 국어
d = int(input())  # 하루에 푸는 수학

e = a // c  # 국어 며칠 걸리는지
f = b // d  # 수학 며칠 걸리는지

if e > f:
    if a % c == 0:
        print(l - e)  # 딱 나누어떨어지면 그대로 빼기
    else:
        print(l - 1 - e)  # 안 떨어지면 하루 더 걸림
else:
    if b % d == 0:
        print(l - f)
    else:
        print(l - 1 - f)