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