Advertisement
yanass

Untitled

Mar 31st, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.13 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 Ежерест
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.            
  14.             int totalMeters = 5364;
  15.             int days = 1;
  16.  
  17.             string command = Console.ReadLine();
  18.  
  19.             while (true)
  20.             {                            
  21.  
  22.                
  23.                 if (command == "Yes")
  24.                 {
  25.                     days++;
  26.                    
  27.                     if (days <= 5)
  28.                     {
  29.                        
  30.                         int metersClimbed = int.Parse(Console.ReadLine());
  31.                         totalMeters += metersClimbed;
  32.  
  33.                        
  34.                         if (totalMeters >= 8848)
  35.                         {
  36.                             break;
  37.                         }
  38.                     }
  39.  
  40.                    
  41.                     else if (days > 5)
  42.                     {
  43.                         break;                        
  44.                     }
  45.                        
  46.                 }
  47.  
  48.                
  49.                 else if (command == "No")
  50.                 {
  51.                     int metersClimbed = int.Parse(Console.ReadLine());
  52.                     totalMeters += metersClimbed;
  53.  
  54.                                      
  55.                     if (totalMeters >= 8848)
  56.                     {
  57.                         break;
  58.                     }
  59.                      
  60.                 }
  61.                 else if (command == "END")
  62.                 {
  63.                     break;                  
  64.                 }
  65.  
  66.                 command = Console.ReadLine();
  67.             }
  68.  
  69.             if (totalMeters < 8848)  
  70.             {
  71.                 Console.WriteLine($"Failed!{Environment.NewLine}{totalMeters}");
  72.                 //Console.WriteLine(totalMeters);
  73.             }
  74.            
  75.             else if (totalMeters >= 8848)
  76.             {
  77.                 Console.WriteLine($"Goal reached for {days} days!");
  78.             }
  79.            
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement