mirror of
https://github.com/Oxbian/CodingGame.git
synced 2025-07-07 04:14:27 +02:00
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
|
|
int main()
|
|
{
|
|
// the number of points used to draw the surface of Mars.
|
|
int surface_n;
|
|
scanf("%d", &surface_n);
|
|
for (int i = 0; i < surface_n; i++) {
|
|
// X coordinate of a surface point. (0 to 6999)
|
|
int land_x;
|
|
// Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
|
|
int land_y;
|
|
scanf("%d%d", &land_x, &land_y);
|
|
}
|
|
|
|
// game loop
|
|
while (1) {
|
|
int X;
|
|
int Y;
|
|
// the horizontal speed (in m/s), can be negative.
|
|
int h_speed;
|
|
// the vertical speed (in m/s), can be negative.
|
|
int v_speed;
|
|
// the quantity of remaining fuel in liters.
|
|
int fuel;
|
|
// the rotation angle in degrees (-90 to 90).
|
|
int rotate;
|
|
// the thrust power (0 to 4).
|
|
int power;
|
|
scanf("%d%d%d%d%d%d%d", &X, &Y, &h_speed, &v_speed, &fuel, &rotate, &power);
|
|
|
|
// Write an action using printf(). DON'T FORGET THE TRAILING \n
|
|
// To debug: fprintf(stderr, "Debug messages...\n");
|
|
|
|
int final_power = 0;
|
|
// 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 (Y > 1500)
|
|
final_power = 3;
|
|
if (Y < 1500 && v_speed < -35)
|
|
final_power = 4;
|
|
|
|
printf("0 %d\n",final_power);
|
|
}
|
|
|
|
return 0;
|
|
} |