Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - using System;
 - namespace CounterStrike
 - {
 - class MainClass
 - {
 - public static void Main()
 - {
 - int energy = int.Parse(Console.ReadLine());
 - int countOfBattles = 0;
 - string command = string.Empty;
 - while((command=Console.ReadLine())!="End of battle")
 - {
 - int distanceEqualToEnergy = int.Parse(command);
 - if (energy >= distanceEqualToEnergy)
 - {
 - energy -= distanceEqualToEnergy;
 - countOfBattles++;
 - }
 - else if (energy < distanceEqualToEnergy)
 - {
 - Console.WriteLine($"Not enough energy! Game ends with {countOfBattles} won battles and {energy} energy");
 - return;
 - }
 - if (countOfBattles % 3 == 0)
 - {
 - energy += countOfBattles;
 - }
 - }
 - Console.WriteLine($"Won battles: {countOfBattles}. Energy left: {energy}");
 - }
 - }
 - }
 
                    Add Comment                
                
                        Please, Sign In to add comment