Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._SoftUni_Reception
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int energy = int.Parse(Console.ReadLine());
- int battles = 0;
- while (true)
- {
- string line = Console.ReadLine();
- if (line == "End of battle")
- {
- Console.WriteLine($"Won battles: {battles}. Energy left: {energy}");
- break;
- }
- int distance = int.Parse(line);
- energy -= distance;
- battles++;
- if (battles % 3 == 0)
- {
- energy += battles;
- }
- }
- if (energy <= 0)
- {
- Console.WriteLine($"Not enough energy! Game ends with {battles} won battles and {energy} energy");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement