Advertisement
go6odn28

counter_strike

Feb 13th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. #https://judge.softuni.org/Contests/Practice/Index/2305#0
  2.  
  3. won_battles = 0
  4. energy = int(input())
  5. not_energy = False
  6.  
  7. while True:
  8.     command = input()
  9.     if command == "End of battle":
  10.         break
  11.  
  12.     distance = int(command)
  13.     if energy - distance >= 0:
  14.         energy -= distance
  15.         won_battles += 1
  16.         if won_battles % 3 == 0:
  17.             energy += won_battles
  18.     else:
  19.         not_energy = True
  20.         print(f"Not enough energy! Game ends with {won_battles} won battles and {energy} energy")
  21.         break
  22.  
  23. if not not_energy:
  24.     print(f"Won battles: {won_battles}. Energy left: {energy}")
  25.  
  26.  
  27. ##
  28. # start_energy = int(input())
  29. # energy = start_energy
  30. # message = ""
  31. # won_count = 0
  32. #
  33. # while True:
  34. #     command = input()
  35. #
  36. #     if command == "End of battle":
  37. #         message = f"Won battles: {won_count}. Energy left: {energy}"
  38. #         break
  39. #
  40. #     energy_to_down = int(command)
  41. #
  42. #     if energy - energy_to_down >= 0:
  43. #         won_count += 1
  44. #         energy -= energy_to_down
  45. #         if won_count % 3 == 0:
  46. #             energy += won_count
  47. #     else:
  48. #         message = f"Not enough energy! Game ends with {won_count} won battles and {energy} energy"
  49. #         break
  50. #
  51. # print(message)
  52.  
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement