Advertisement
spasnikolov131

Untitled

Jun 14th, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Everest
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int baseCamp = 5364;
  10. const int top = 8848;
  11. int countDays = 1;
  12.  
  13. string text = Console.ReadLine();
  14.  
  15. while (text != "END")
  16. {
  17. if (text == "Yes")
  18. {
  19. int additional = int.Parse(Console.ReadLine());
  20. baseCamp += additional;
  21. countDays++;
  22.  
  23. }
  24. else if (text == "No")
  25. {
  26. baseCamp += int.Parse(Console.ReadLine());
  27.  
  28. countDays++;
  29. }
  30. if (baseCamp > top)
  31. {
  32.  
  33. Console.WriteLine($"Goal reached for {countDays} days!");
  34. break;
  35. }
  36. if (countDays > 4)
  37. {
  38.  
  39. Console.WriteLine("Failed!");
  40. Console.WriteLine($"{baseCamp}");
  41. break;
  42. }
  43. text = Console.ReadLine();
  44.  
  45. }
  46. if (top > baseCamp)
  47. {
  48. Console.WriteLine("Failed!");
  49. Console.WriteLine($"{baseCamp}");
  50. }
  51.  
  52.  
  53.  
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement