Accepted
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