Advertisement
DiYane

Counter-Strike

Sep 16th, 2023
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. initial_energy = int(input())
  2. command = input()
  3. battles_won = 0
  4. enough_initial_energy = True
  5.  
  6. while command != 'End of battle':
  7.     distance = int(command)
  8.     if initial_energy - distance < 0:
  9.         enough_initial_energy = False
  10.         print(f"Not enough energy! Game ends with {battles_won} won battles and {initial_energy} energy")
  11.         break
  12.     initial_energy -= distance  
  13.     battles_won += 1
  14.     if battles_won % 3 == 0:
  15.         initial_energy += battles_won
  16.     command = input()
  17.  
  18. if enough_initial_energy:
  19.     print(f"Won battles: {battles_won}. Energy left: {initial_energy}" )
  20.  
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement