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