/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Runtime Error Traceback (most recent call last): File "foo.py", line 13, in <module> NameError: name 'true' is not defined. Did you mean: 'True'? 15ms 3.074 MiB
#2 Accepted 15ms 3.059 MiB
#3 Runtime Error Traceback (most recent call last): File "foo.py", line 13, in <module> NameError: name 'true' is not defined. Did you mean: 'True'? 14ms 2.887 MiB

Code

cnt = 10000000000
ok = False
X,a,b,c,n=map(int,input().split())

x=n//a +1
y=n//b +1
z=n//c +1

for i in range(x+1):
    for j in range(y+1):
        for k in range(z+1):
            if(a*i+b*j+c*k+X == n):
                ok=true
                cnt=min(cnt,i+j+k)
if(ok):
    print("YES")
    print(cnt)
else:
    print("NO")

Information

Submit By
Type
Submission
Problem
P1028 Magical box and spell
Language
Python 3 (Python 3.12.3)
Submit At
2024-02-01 17:25:04
Judged At
2024-11-11 03:43:25
Judged By
Score
5
Total Time
15ms
Peak Memory
3.074 MiB