1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| def solution(bandage, health, attacks):
answer = health
t = 0
max_tps = attacks[len(attacks)-1][0]
band = 0
print(max_tps)
att = 0
while t <= max_tps :
print('dans while, t = ', t)
print('attacks[att][0] = ', attacks[att][0])
if t == attacks[att][0]:
print('dans if, il y a une attaque')
answer -= attacks[att][1]
att += 1
band = 0
if answer <= 0:
print('la mort')
return -1
else :
print('dans else, pas attaque')
band += 1
if band < bandage[0]:
print('dans if, nb band max pas atteint')
answer += bandage[1]
elif band == bandage[0]:
print('dans else, nb band max atteint')
answer += (bandage[1] + bandage[2])
band = 0
if answer > health :
answer = health
print('answer fin while = ', answer, ' // nb band = ', band)
t += 1
print()
return answer
|