Accepted
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