Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace highJump
- {
- class Program
- {
- static void Main(string[] args)
- {
- int desire = int.Parse(Console.ReadLine());
- int start = desire - 30;
- int failCount = 0;
- int jumpCounter = 0;
- int jump = 0;
- while (jump < desire)
- {
- jump = int.Parse(Console.ReadLine());
- jumpCounter++;
- if (jump<=start)
- {
- failCount++;
- if (failCount==3)
- {
- Console.WriteLine($"Tihomir failed at {start}cm after {jumpCounter} jumps.");
- break;
- }
- }
- if (jump > start)
- {
- start += 5;
- failCount = 0;
- }
- }
- if (jump > desire)
- {
- start -= 5;
- Console.WriteLine($"Tihomir succeeded, he jumped over {start}cm after {jumpCounter} jumps.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement