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