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