Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HighJump
- {
- class Program
- {
- static void Main(string[] args)
- {
- int targetHight = int.Parse(Console.ReadLine());
- int poleHight = targetHight - 30;
- int jumpHight = 0;
- int jumpsCounter = 0;
- int failedJumpsCounter = 0;
- while (jumpHight <= targetHight)
- {
- jumpHight = int.Parse(Console.ReadLine());
- jumpsCounter++;
- if (jumpHight <= poleHight)
- {
- failedJumpsCounter++;
- if (failedJumpsCounter == 3)
- {
- Console.WriteLine($"Tihomir failed at {poleHight}cm after {jumpsCounter} jumps.");
- break;
- }
- }
- else if (jumpHight > poleHight)
- {
- poleHight += 5;
- failedJumpsCounter = 0;
- if (jumpHight > targetHight)
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {targetHight}cm after {jumpsCounter} jumps.");
- break;
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment