Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- MARS_GRAVITY = 3.711
- flat_y = 0
- land_y_old = 0
- def start_burn():
- while True:
- print("0 4")
- surface_n = int(input()) # the number of points used to draw the surface of Mars.
- for i in range(surface_n):
- # land_x: X coordinate of a surface point. (0 to 6999)
- # land_y: Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
- land_x, land_y = [int(j) for j in input().split()]
- if land_y_old == land_y:
- flat_y = land_y
- land_y_old = land_y
- iter = 0
- # game loop
- while True:
- # h_speed: the horizontal speed (in m/s), can be negative.
- # v_speed: the vertical speed (in m/s), can be negative.
- # fuel: the quantity of remaining fuel in liters.
- # rotate: the rotation angle in degrees (-90 to 90).
- # power: the thrust power (0 to 4).
- x, y, h_speed, v_speed, fuel, rotate, power = [int(i) for i in input().split()]
- if iter == 0:
- landing_y = y - flat_y
- print(landing_y, file=sys.stderr, flush=True)
- # Write an action using print
- # To debug: print("Debug messages...", file=sys.stderr, flush=True)
- v_initial = math.sqrt(abs(400 - (2 * (4 - MARS_GRAVITY) * landing_y * -1)))
- print(v_initial, file=sys.stderr, flush=True)
- # 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).
- if abs(v_speed) >= v_initial:
- start_burn()
- else:
- print("0 0")
- iter += 1
- #####################################################################################################################
- from console:
- Standard Error Stream: (DEBUG)
- 42.275288289969126
- Standard Output Stream:
- 0 0
- Game information:
- Landing in progress...
- X=2500m, Y=2275m, HSpeed=0m/s VSpeed=-41m/s
- Fuel=500l, Angle=0°, Power=0 (0.0m/s2)
- 11
- 62
- Standard Error Stream:
- 42.275288289969126
- Standard Output Stream:
- 0 0
- Game information:
- Landing in progress...
- X=2500m, Y=2233m, HSpeed=0m/s VSpeed=-45m/s
- Fuel=500l, Angle=0°, Power=0 (0.0m/s2)
- 12
- 62
- Standard Error Stream:
- 42.275288289969126
- Standard Output Stream:
- 0 4
- Game information:
- Landing in progress...
- X=2500m, Y=2187m, HSpeed=0m/s VSpeed=-47m/s
- Fuel=499l, Angle=0°, Power=1 (1.0m/s2)
- 13
- 62
- Standard Output Stream:
- 0 4
- Game information:
- Landing in progress...
- X=2500m, Y=2139m, HSpeed=0m/s VSpeed=-49m/s
- Fuel=497l, Angle=0°, Power=2 (2.0m/s2)
- it took it 2 more iterations to realize that the if statement is True.............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement