Advertisement
red_dragon_1

Untitled

Apr 4th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace number4
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int wishedHeight = int.Parse(Console.ReadLine());
  10.  
  11. int jumpsSUCSESSCounter = 1;
  12. int jumpsWithoutSUCSESSCounter = 0;
  13. int letvaHeight = wishedHeight - 30;
  14.  
  15. int heightChageSum = wishedHeight;
  16.  
  17. int jumpAgain = 0;
  18.  
  19.  
  20. while (heightChageSum >= letvaHeight)
  21. {
  22. jumpAgain = int.Parse(Console.ReadLine());
  23.  
  24. if (letvaHeight == heightChageSum)
  25. {
  26. break;
  27. }
  28.  
  29. if (jumpAgain > letvaHeight)
  30. {
  31.  
  32. if (jumpAgain > heightChageSum)
  33. {
  34.  
  35. letvaHeight += 5;
  36. jumpsWithoutSUCSESSCounter = 0;
  37. jumpsSUCSESSCounter++;
  38. continue;
  39. }
  40.  
  41. letvaHeight += 5;
  42. jumpsWithoutSUCSESSCounter = 0;
  43.  
  44. }
  45.  
  46.  
  47. else if(jumpAgain <= letvaHeight)
  48. {
  49. jumpsWithoutSUCSESSCounter++;
  50.  
  51. }
  52.  
  53.  
  54. if (jumpsWithoutSUCSESSCounter == 3)
  55. {
  56. Console.WriteLine($"Tihomir failed at {letvaHeight}cm after {jumpsSUCSESSCounter} jumps.");
  57. return;
  58.  
  59. }
  60. jumpsSUCSESSCounter++;
  61.  
  62. }
  63.  
  64.  
  65. {
  66. Console.WriteLine($"Tihomir succeeded, he jumped over {letvaHeight}cm after {jumpsSUCSESSCounter} jumps.");
  67. }
  68.  
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement