SHARE
TWEET

06. High Jump

stbodurov Mar 17th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace OfficialExam1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int wantedHeight = int.Parse(Console.ReadLine());
  14.  
  15.  
  16.             int lathHeight = wantedHeight - 30;
  17.             int jumpCounter = 0;
  18.             int currentTry = 0;
  19.             int jumpHeight = 0;
  20.  
  21.             while (true)
  22.             {
  23.                 for (currentTry = 1; currentTry <= 3; currentTry++)
  24.                 {
  25.                     jumpHeight = int.Parse(Console.ReadLine());
  26.                     jumpCounter++;
  27.                     if (jumpHeight > wantedHeight)
  28.                     {
  29.                         Console.WriteLine($"Tihomir succeeded, he jumped over {wantedHeight}cm after {jumpCounter} jumps.");
  30.                         return;
  31.                     }
  32.                     if (jumpHeight > lathHeight)
  33.                     {
  34.                         lathHeight += 5;
  35.                         break;
  36.                     }
  37.                      
  38.                    
  39.                 }
  40.                 if (currentTry == 4)
  41.                 {
  42.                     Console.WriteLine($"Tihomir failed at {lathHeight}cm after {jumpCounter} jumps.");
  43.                     return;
  44.                 }
  45.  
  46.             }
  47.         }
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top