Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace number4
- {
- class Program
- {
- static void Main(string[] args)
- {
- int wishedHeight = int.Parse(Console.ReadLine());
- int jumpsSUCSESSCounter = 1;
- int jumpsWithoutSUCSESSCounter = 0;
- int letvaHeight = wishedHeight - 30;
- int heightChageSum = wishedHeight;
- int jumpAgain = 0;
- while (heightChageSum >= letvaHeight)
- {
- jumpAgain = int.Parse(Console.ReadLine());
- if (letvaHeight == heightChageSum)
- {
- break;
- }
- if (jumpAgain > letvaHeight)
- {
- if (jumpAgain > heightChageSum)
- {
- letvaHeight += 5;
- jumpsWithoutSUCSESSCounter = 0;
- jumpsSUCSESSCounter++;
- continue;
- }
- letvaHeight += 5;
- jumpsWithoutSUCSESSCounter = 0;
- }
- else if(jumpAgain <= letvaHeight)
- {
- jumpsWithoutSUCSESSCounter++;
- }
- if (jumpsWithoutSUCSESSCounter == 3)
- {
- Console.WriteLine($"Tihomir failed at {letvaHeight}cm after {jumpsSUCSESSCounter} jumps.");
- return;
- }
- jumpsSUCSESSCounter++;
- }
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {letvaHeight}cm after {jumpsSUCSESSCounter} jumps.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement