forked from ntalfer/codingame
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathskynet_le_saut.cpp
47 lines (41 loc) · 884 Bytes
/
skynet_le_saut.cpp
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
44
45
46
47
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Read init information from standard input, if any
int r, g, l;
cin >> r >> g >> l;
while (1) {
// Read information from standard input
int s, x;
cin >> s >> x;
string cmd;
// Compute logic here
if(x < r-1)
{
if(s < g+1)
cmd = "SPEED";
else if(s > g+1)
cmd = "SLOW";
else
cmd = "WAIT";
}
else if(x == r-1)
{
cmd = "JUMP";
}
else if(x < r+g)
{
cmd = "WAIT";
}
else
{
cmd = "SLOW";
}
// cerr << "Debug messages..." << endl;
// Write action to standard output
cout << cmd << endl;
}
return 0;
}