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 jumpTarget = int.Parse(Console.ReadLine());
- int startJump = jumpTarget - 30;
- int counter = 0;
- int fall = 0;
- while (fall != 3 && startJump <= jumpTarget)
- {
- int jump = int.Parse(Console.ReadLine());
- if (jump > startJump)
- {
- startJump += 5;
- fall = 0;
- }
- else
- {
- fall++;
- }
- counter++;
- }
- if (startJump <= jumpTarget)
- {
- Console.WriteLine($"Tihomir failed at {startJump}cm after {counter} jumps.");
- }
- else
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {jumpTarget}cm after {counter} jumps.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment