-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
109 lines (100 loc) · 2.28 KB
/
main.cpp
File metadata and controls
109 lines (100 loc) · 2.28 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <bits/stdc++.h>
using namespace std;
const int n = 200;
const int robot_num = 10;
const int berth_num = 10;
const int N = 210;
struct Robot
{
int x, y, goods;
int status;
int mbx, mby;
Robot() {}
Robot(int startX, int startY) {
x = startX;
y = startY;
}
}robot[robot_num + 10];
struct Berth
{
int x;
int y;
int transport_time;
int loading_speed;
Berth(){}
Berth(int x, int y, int transport_time, int loading_speed) {
this -> x = x;
this -> y = y;
this -> transport_time = transport_time;
this -> loading_speed = loading_speed;
}
}berth[berth_num + 10];
struct Boat
{
int num, pos, status;
}boat[10];
int money, boat_capacity, id;
char ch[N][N];
int gds[N][N];
void Init()
{
// 地图初始化
for(int i = 1; i <= n; i ++)
scanf("%s", ch[i] + 1);
// 泊位初始化
for(int i = 0; i < berth_num; i ++)
{
int id;
scanf("%d", &id);
scanf("%d%d%d%d", &berth[id].x, &berth[id].y, &berth[id].transport_time, &berth[id].loading_speed);
}
// 船只容量
scanf("%d", &boat_capacity);
// 传输结束
char okk[100];
scanf("%s", okk);
printf("OK\n");
fflush(stdout);
}
int Input()
{
// 帧序号;金钱数
scanf("%d%d", &id, &money);
// 新增货物数
int num;
scanf("%d", &num);
// 货物坐标;价值(<=1000)
for(int i = 1; i <= num; i ++)
{
int x, y, val;
scanf("%d%d%d", &x, &y, &val);
}
// 机器人:是否携带物品{0, 1};坐标;状态{0(撞墙和重叠), 1}
for(int i = 0; i < robot_num; i ++)
{
int sts;
scanf("%d%d%d%d", &robot[i].goods, &robot[i].x, &robot[i].y, &sts);
}
// 船只
// 状态:0(移动);1(正常);2(泊位外等待)
// 泊位id:虚拟泊位-1
for(int i = 0; i < 5; i ++)
scanf("%d%d\n", &boat[i].status, &boat[i].pos);
// 输入结束
char okk[100];
scanf("%s", okk);
return id;
}
int main()
{
Init();
for(int zhen = 1; zhen <= 15000; zhen ++)
{
int id = Input();
for(int i = 0; i < robot_num; i ++)
printf("move %d %d\n", i, rand() % 4);
puts("OK");
fflush(stdout);
}
return 0;
}