Sichanov

counter-strike

Oct 23rd, 2021
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. initial_energy = int(input())
  2.  
  3. command = input()
  4. count = 0
  5. not_enough_energy = False
  6. while not command == 'End of battle':
  7.     distance = int(command)
  8.     if initial_energy - distance >= 0:
  9.         initial_energy -= distance
  10.         count += 1
  11.         if count % 3 == 0:
  12.             initial_energy += count
  13.     else:
  14.         print(f'Not enough energy! Game ends with {count} won battles and {initial_energy} energy')
  15.         not_enough_energy = True
  16.         break
  17.  
  18.     command = input()
  19. if not not_enough_energy:
  20.     print(f'Won battles: {count}. Energy left: {initial_energy}')
Advertisement
Add Comment
Please, Sign In to add comment