Guest User

Untitled

a guest
Jul 4th, 2021
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CounterStrike
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double energy = double.Parse(Console.ReadLine());
  10. int wins = 0;
  11.  
  12. string command = Console.ReadLine();
  13.  
  14. while (command != "End of battle")
  15. {
  16.  
  17. double distance = double.Parse(command);
  18.  
  19. if (energy < distance)
  20. {
  21. Console.WriteLine($"Not enough energy! Game ends with {wins} won battles and {energy} energy");
  22. break;
  23. }
  24.  
  25. energy -= distance;
  26. wins++;
  27.  
  28. if (wins % 3 == 0)
  29. {
  30. energy += wins;
  31. }
  32.  
  33. command = Console.ReadLine();
  34. }
  35.  
  36. if (energy > 0)
  37. {
  38. Console.WriteLine($"Won battles: {wins}. Energy left: {energy}");
  39. }
  40.  
  41. }
  42. }
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment