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 Arrays_NewStart
- {
- class Program
- {
- static void Main(string[] args)
- {
- int target = int.Parse(Console.ReadLine());
- int startingPoint = target - 30;
- int jump = 0;
- int counter = 0;
- int failJumps = 0;
- while (jump < target && target >= 100 && target <= 300)
- {
- jump = int.Parse(Console.ReadLine());
- counter++;
- if (jump > startingPoint && jump < target )
- {
- startingPoint += 5;
- failJumps = 0;
- }
- else
- {
- failJumps++;
- }
- if (failJumps == 3)
- {
- Console.WriteLine($"Tihomir failed at {startingPoint}cm after {counter} jumps.");
- break;
- }
- else if (jump > target)
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {startingPoint}cm after {counter} jumps.");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement