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 maxHeight = int.Parse(Console.ReadLine());
- int startHeight = maxHeight - 30;
- int allJumps = 0;
- int failJumps = 0;
- for (int i = startHeight; i < maxHeight + 5; i += 5)
- {
- int jumpHeight = int.Parse(Console.ReadLine());
- allJumps++;
- if (jumpHeight <= i)
- {
- failJumps++;
- if (failJumps.Equals(3))
- {
- Console.WriteLine($"Tihomir failed at {i}cm after {allJumps} jumps.");
- break;
- }
- i -= 5;
- }
- else
- {
- failJumps = 0;
- }
- }
- if (failJumps < 3)
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {maxHeight}cm after {allJumps} jumps.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement