Add Add kode py soal Kodenesia 4.27
This commit is contained in:
parent
ba3eb52f86
commit
c703fe2c1f
21
Add kode py soal Kodenesia 4.27
Normal file
21
Add kode py soal Kodenesia 4.27
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
while True:
|
||||||
|
try:
|
||||||
|
S, n, a, b = map(int, input().split())
|
||||||
|
bisa = False
|
||||||
|
|
||||||
|
for x in range(n + 1): # jumlah benar
|
||||||
|
for y in range(n - x + 1): # jumlah salah
|
||||||
|
z = n - x - y # tidak dijawab
|
||||||
|
|
||||||
|
nilai = a * x - b * y
|
||||||
|
|
||||||
|
if nilai == S:
|
||||||
|
bisa = True
|
||||||
|
break
|
||||||
|
if bisa:
|
||||||
|
break
|
||||||
|
|
||||||
|
print("YA" if bisa else "TIDAK")
|
||||||
|
|
||||||
|
except:
|
||||||
|
break
|
||||||
Loading…
x
Reference in New Issue
Block a user