/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.066 MiB
#2 Accepted 14ms 3.066 MiB
#3 Accepted 14ms 3.125 MiB
#4 Accepted 15ms 3.082 MiB
#5 Accepted 15ms 3.066 MiB
#6 Accepted 14ms 2.883 MiB
#7 Accepted 14ms 3.145 MiB
#8 Accepted 16ms 3.074 MiB
#9 Accepted 14ms 2.883 MiB
#10 Accepted 14ms 3.125 MiB
#11 Accepted 15ms 3.051 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-11-11 03:41:14
Judged By
Score
100
Total Time
16ms
Peak Memory
3.145 MiB