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