-
Notifications
You must be signed in to change notification settings - Fork 3
/
the_bridge_episode_1.c
43 lines (36 loc) · 1 KB
/
the_bridge_episode_1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
int road; // the length of the road before the gap.
scanf("%d", &road);
int gap; // the length of the gap.
scanf("%d", &gap);
int platform; // the length of the landing platform.
scanf("%d", &platform);
// game loop
while (1) {
int speed; // the motorbike's speed.
scanf("%d", &speed);
int x; // the position on the road of the motorbike.
scanf("%d", &x);
if(x + speed >= road + gap && x < road)
printf("JUMP\n");
else if(speed < gap + 1 && x < road)
printf("SPEED\n");
else if(speed > gap + 1 && x < road)
printf("SLOW\n");
else if(x >= road + gap) {
printf("SLOW\n");
}
else {
printf("WAIT\n");
}
}
return 0;
}