/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 20ms 3.066 MiB
#2 Accepted 20ms 2.984 MiB
#3 Accepted 21ms 3.117 MiB
#4 Accepted 21ms 3.035 MiB
#5 Accepted 21ms 3.102 MiB
#6 Accepted 21ms 3.094 MiB
#7 Accepted 22ms 3.043 MiB
#8 Accepted 21ms 3.117 MiB
#9 Accepted 22ms 3.117 MiB
#10 Accepted 22ms 2.941 MiB
#11 Accepted 21ms 3.094 MiB

Code

'''CODED BY mahmudulsakib2019
 DATE:-06/03/2024; TIME:-20:50pm
  BANGALDESH , SYLHET'''
T = 1
for _ in range(T):
    X, a, b, c, N = map(int, input().split())
    dp = [1e9] * (N + 1)
    dp[X] = 0
    for i in range(X, N + 1):
        if i + a <= N:
            dp[i + a] = min(dp[i + a], dp[i] + 1)
        if i + b <= N:
            dp[i + b] = min(dp[i + b], dp[i] + 1)
        if i + c <= N:
            dp[i + c] = min(dp[i + c], dp[i] + 1)
    if dp[N] == 1e9:
        print("NO")
    else:
        print("YES")
        print(dp[N])


Information

Submit By
Type
Submission
Problem
P1028 Magical box and spell
Contest
Brain booster #2
Language
Python 3 (Python 3.12.3)
Submit At
2024-03-06 16:40:05
Judged At
2024-10-03 14:00:02
Judged By
Score
100
Total Time
22ms
Peak Memory
3.117 MiB