Advertisement
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 desiredHeight = int.Parse(Console.ReadLine());
- int currentJump = int.Parse(Console.ReadLine());
- int changedDesiredHeight = desiredHeight - 30;
- int failedJumps = 0;
- int totalJumps = 1;
- while (currentJump < desiredHeight)
- {
- if (currentJump > changedDesiredHeight)
- {
- changedDesiredHeight += 5;
- failedJumps = 0;
- }
- else
- {
- failedJumps++;
- if (failedJumps == 3)
- {
- Console.WriteLine($"Tihomir failed at {changedDesiredHeight}cm after {totalJumps} jumps.");
- return;
- }
- }
- currentJump = int.Parse(Console.ReadLine());
- totalJumps++;
- }
- Console.WriteLine($"Tihomir succeeded, he jumped over {changedDesiredHeight}cm after {totalJumps} jumps.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement