Advertisement
mark79

Everest

Dec 30th, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Everest
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int top = 8848;
  14.             int progress = 5364;
  15.             int countDni = 1;
  16.             string simbol = "";
  17.  
  18.             while (progress < top && countDni < 6 && (simbol = Console.ReadLine()) != "END")
  19.             {
  20.  
  21.                 if (simbol == "Yes")
  22.                 {
  23.                     countDni++;
  24.                 }
  25.  
  26.                 int distance = int.Parse(Console.ReadLine());
  27.  
  28.                 if (countDni < 6)
  29.                 {
  30.                     progress += distance;
  31.                 }
  32.  
  33.             }
  34.  
  35.             if (progress >= top)
  36.             {
  37.                 Console.WriteLine($"Goal reached for {countDni} days!");
  38.             }
  39.             else
  40.             {
  41.                 Console.WriteLine("Failed!");
  42.                 Console.WriteLine(progress);
  43.             }
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement