61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Auto-generated code below aims at helping you parse
|
|
* the standard input according to the problem statement.
|
|
**/
|
|
|
|
fscanf(STDIN, "%d",
|
|
$N // the number of points used to draw the surface of Mars.
|
|
);
|
|
for ($i = 0; $i < $N; $i++)
|
|
{
|
|
fscanf(STDIN, "%d %d",
|
|
$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.
|
|
);
|
|
}
|
|
|
|
function R($R, $SPEED) {
|
|
echo $R, ' ', $SPEED, "\n";
|
|
}
|
|
|
|
// game loop
|
|
while (TRUE)
|
|
{
|
|
fscanf(STDIN, "%d %d %d %d %d %d %d",
|
|
$X,
|
|
$Y,
|
|
$HS, // the horizontal speed (in m/s), can be negative.
|
|
$VS, // the vertical speed (in m/s), can be negative.
|
|
$F, // the quantity of remaining fuel in liters.
|
|
$R, // the rotation angle in degrees (-90 to 90).
|
|
$P // the thrust power (0 to 4).
|
|
);
|
|
|
|
if (abs($HS) < 70 && $Y < 2200) {
|
|
if ($Y < 200) {
|
|
r(0, 4);
|
|
} else {
|
|
if ($LAND_X < $X) {
|
|
r(20, 4);
|
|
} else {
|
|
r(-20, 4);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if (abs($R) < 40) {
|
|
$SPEED = 0;
|
|
} else {
|
|
$SPEED = 4;
|
|
}
|
|
$q = $HS > 0 ? -1 : 1;
|
|
|
|
if ($LAND_X < $X) {
|
|
r(50 * $q, $SPEED);
|
|
} else {
|
|
r(-50 * $q, $SPEED);
|
|
}
|
|
}
|
|
}
|
|
?>
|