-
Notifications
You must be signed in to change notification settings - Fork 4
/
AI.cpp
59 lines (44 loc) · 775 Bytes
/
AI.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
48
49
50
51
52
53
54
55
56
57
58
59
#include<iostream>
#include<cstring>
using namespace std;
void rescue(int n,char* s)
{
if(s[0][0]=='p')
{
for(int i=0;i<n/2;i++)
{ cout<<"LEFT"<<endl; }
for(int j=0;j<n/2;j++)
{ cout<<"UP"<<endl; }
}
if(s[0][(n/2)*2]=='p')
{
for(int i=0;i<n/2;i++)
{ cout<<"RIGHT"<<endl; }
for(int j=0;j<n/2;j++)
{ cout<<"UP"<<endl; }
}
if(s[(n/2)*2][0]=='p')
{
for(int i=0;i<n/2;i++)
{ cout<<"DOWN"<<endl; }
for(int j=0;j<n/2;j++)
{ cout<<"LEFT"<<endl; }
}
if(s[(n/2)*2][(n/2)*2]=='p')
{
for(int i=0;i<n/2;i++)
{ cout<<"DOWN"<<endl; }
for(int j=0;j<n/2;j++)
{ cout<<"RIGHT"<<endl; }
}
}
int main()
{
int m; cin>>m;
char s[m][m];
for(int i=0;i<m;i++) {
for(int j=0;j<m;j++) {
cin>>s[i][j]; } }
rescue(m,s);
return 0;
}