Advertisement
elninio_79

Untitled

Mar 19th, 2019
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace highJump
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int desire = int.Parse(Console.ReadLine());
  14.  
  15. int start = desire - 30;
  16. int failCount = 0;
  17. int jumpCounter = 0;
  18.  
  19.  
  20. int jump = 0;
  21. while (jump < desire)
  22. {
  23. jump = int.Parse(Console.ReadLine());
  24. jumpCounter++;
  25.  
  26.  
  27.  
  28. if (jump<=start)
  29. {
  30. failCount++;
  31. if (failCount==3)
  32. {
  33. Console.WriteLine($"Tihomir failed at {start}cm after {jumpCounter} jumps.");
  34. break;
  35. }
  36. }
  37. if (jump > start)
  38. {
  39. start += 5;
  40. failCount = 0;
  41.  
  42. }
  43.  
  44. }
  45. if (jump > desire)
  46. {
  47. start -= 5;
  48. Console.WriteLine($"Tihomir succeeded, he jumped over {start}cm after {jumpCounter} jumps.");
  49. }
  50.  
  51.  
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement