Advertisement
Guest User

Untitled

a guest
Jul 9th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. # Auto-generated code below aims at helping you parse
  5. # the standard input according to the problem statement.
  6. MARS_GRAVITY = 3.711
  7. flat_y = 0
  8. land_y_old = 0
  9.  
  10. def start_burn():
  11. while True:
  12. print("0 4")
  13.  
  14. surface_n = int(input()) # the number of points used to draw the surface of Mars.
  15. for i in range(surface_n):
  16. # land_x: X coordinate of a surface point. (0 to 6999)
  17. # land_y: Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
  18. land_x, land_y = [int(j) for j in input().split()]
  19.  
  20. if land_y_old == land_y:
  21. flat_y = land_y
  22.  
  23. land_y_old = land_y
  24.  
  25. iter = 0
  26. # game loop
  27. while True:
  28. # h_speed: the horizontal speed (in m/s), can be negative.
  29. # v_speed: the vertical speed (in m/s), can be negative.
  30. # fuel: the quantity of remaining fuel in liters.
  31. # rotate: the rotation angle in degrees (-90 to 90).
  32. # power: the thrust power (0 to 4).
  33. x, y, h_speed, v_speed, fuel, rotate, power = [int(i) for i in input().split()]
  34.  
  35. if iter == 0:
  36. landing_y = y - flat_y
  37. print(landing_y, file=sys.stderr, flush=True)
  38. # Write an action using print
  39. # To debug: print("Debug messages...", file=sys.stderr, flush=True)
  40. v_initial = math.sqrt(abs(400 - (2 * (4 - MARS_GRAVITY) * landing_y * -1)))
  41. print(v_initial, file=sys.stderr, flush=True)
  42.  
  43.  
  44. # 2 integers: rotate power. rotate is the desired rotation angle (should be 0 for level 1), power is the desired thrust power (0 to 4).
  45. if abs(v_speed) >= v_initial:
  46. start_burn()
  47.  
  48. else:
  49. print("0 0")
  50.  
  51. iter += 1
  52. #####################################################################################################################
  53.  
  54. from console:
  55.  
  56. Standard Error Stream: (DEBUG)
  57. 42.275288289969126
  58.  
  59. Standard Output Stream:
  60. 0 0
  61. Game information:
  62. Landing in progress...
  63. X=2500m, Y=2275m, HSpeed=0m/s VSpeed=-41m/s
  64. Fuel=500l, Angle=0°, Power=0 (0.0m/s2)
  65. 11
  66. 62
  67.  
  68. Standard Error Stream:
  69. 42.275288289969126
  70.  
  71. Standard Output Stream:
  72. 0 0
  73. Game information:
  74. Landing in progress...
  75. X=2500m, Y=2233m, HSpeed=0m/s VSpeed=-45m/s
  76. Fuel=500l, Angle=0°, Power=0 (0.0m/s2)
  77. 12
  78. 62
  79.  
  80. Standard Error Stream:
  81. 42.275288289969126
  82.  
  83. Standard Output Stream:
  84. 0 4
  85. Game information:
  86. Landing in progress...
  87. X=2500m, Y=2187m, HSpeed=0m/s VSpeed=-47m/s
  88. Fuel=499l, Angle=0°, Power=1 (1.0m/s2)
  89. 13
  90. 62
  91.  
  92. Standard Output Stream:
  93. 0 4
  94. Game information:
  95. Landing in progress...
  96. X=2500m, Y=2139m, HSpeed=0m/s VSpeed=-49m/s
  97. Fuel=497l, Angle=0°, Power=2 (2.0m/s2)
  98.  
  99. it took it 2 more iterations to realize that the if statement is True.............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement