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