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 OfficialExam1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int wantedHeight = int.Parse(Console.ReadLine());
- int lathHeight = wantedHeight - 30;
- int jumpCounter = 0;
- int currentTry = 0;
- int jumpHeight = 0;
- while (true)
- {
- for (currentTry = 1; currentTry <= 3; currentTry++)
- {
- jumpHeight = int.Parse(Console.ReadLine());
- jumpCounter++;
- if (jumpHeight > wantedHeight)
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {wantedHeight}cm after {jumpCounter} jumps.");
- return;
- }
- if (jumpHeight > lathHeight)
- {
- lathHeight += 5;
- break;
- }
- }
- if (currentTry == 4)
- {
- Console.WriteLine($"Tihomir failed at {lathHeight}cm after {jumpCounter} jumps.");
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement