/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 2.887 MiB
#2 Accepted 15ms 3.109 MiB
#3 Accepted 15ms 3.07 MiB
#4 Accepted 15ms 3.078 MiB
#5 Accepted 15ms 2.91 MiB
#6 Accepted 15ms 2.961 MiB
#7 Accepted 16ms 3.066 MiB
#8 Accepted 15ms 3.0 MiB
#9 Accepted 15ms 3.121 MiB
#10 Accepted 15ms 2.883 MiB
#11 Accepted 15ms 3.105 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-11-11 03:41:07
Judged By
Score
100
Total Time
16ms
Peak Memory
3.121 MiB