Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://judge.softuni.org/Contests/Practice/Index/2305#0
- won_battles = 0
- energy = int(input())
- not_energy = False
- while True:
- command = input()
- if command == "End of battle":
- break
- distance = int(command)
- if energy - distance >= 0:
- energy -= distance
- won_battles += 1
- if won_battles % 3 == 0:
- energy += won_battles
- else:
- not_energy = True
- print(f"Not enough energy! Game ends with {won_battles} won battles and {energy} energy")
- break
- if not not_energy:
- print(f"Won battles: {won_battles}. Energy left: {energy}")
- ##
- # start_energy = int(input())
- # energy = start_energy
- # message = ""
- # won_count = 0
- #
- # while True:
- # command = input()
- #
- # if command == "End of battle":
- # message = f"Won battles: {won_count}. Energy left: {energy}"
- # break
- #
- # energy_to_down = int(command)
- #
- # if energy - energy_to_down >= 0:
- # won_count += 1
- # energy -= energy_to_down
- # if won_count % 3 == 0:
- # energy += won_count
- # else:
- # message = f"Not enough energy! Game ends with {won_count} won battles and {energy} energy"
- # break
- #
- # print(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement