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