Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Everest
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int baseCamp = 5364;
- const int top = 8848;
- int countDays = 1;
- string text = Console.ReadLine();
- while (text != "END")
- {
- if (text == "Yes")
- {
- int additional = int.Parse(Console.ReadLine());
- baseCamp += additional;
- countDays++;
- }
- else if (text == "No")
- {
- baseCamp += int.Parse(Console.ReadLine());
- countDays++;
- }
- if (baseCamp > top)
- {
- Console.WriteLine($"Goal reached for {countDays} days!");
- break;
- }
- if (countDays > 4)
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{baseCamp}");
- break;
- }
- text = Console.ReadLine();
- }
- if (top > baseCamp)
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{baseCamp}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement