Advertisement
Valantina

Everest/Exam

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