Untitled
unknown
python
4 years ago
750 B
8
Indexable
D = 140 n = 4 a = [15, 25, 35, 25] d = [1, 2, 1, 2] t = [0.8, 0.8, 0.8, 0.8] S = 5 def checkVaccine(D): i = 0 amin = [] for e in a: amin.append(round(e*t[i])) i += 1 i = 0 for e in amin: D -= e*d[i] if D < 0: print("No-instance") return i += 1 if D > 0: print(D) i = 0 for e in a: rem = round((e-amin[i])*d[i]) if rem <= D: D -= rem else: D = 0 print("Yes-instance") return i += 1 if D > S: print("No2-instance") else: print("Yes2-instance") checkVaccine(D)
Editor is loading...