/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.008 MiB
#2 Accepted 16ms 2.969 MiB
#3 Accepted 16ms 2.887 MiB
#4 Accepted 15ms 3.086 MiB
#5 Accepted 15ms 3.062 MiB
#6 Accepted 15ms 3.062 MiB
#7 Accepted 15ms 2.906 MiB
#8 Accepted 15ms 2.961 MiB
#9 Accepted 15ms 2.949 MiB
#10 Accepted 16ms 3.121 MiB
#11 Accepted 16ms 2.906 MiB

Code

X, a, b, c, N = map(int, input().split())
z = [1e9] * (N + 1)
z[X] = 0
for i in range(X, N + 1):
    if i + a <= N:
        z[i + a] = min(z[i + a], z[i] + 1)
    if i + b <= N:
        z[i + b] = min(z[i + b], z[i] + 1)
    if i + c <= N:
        z[i + c] = min(z[i + c], z[i] + 1)
if z[N] == 1e9:
    print("NO")
else:
    print("YES")
    print(z[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:59:09
Judged At
2024-10-03 13:59:48
Judged By
Score
100
Total Time
16ms
Peak Memory
3.121 MiB