-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathda_pra_terminar.cpp
65 lines (55 loc) · 1.3 KB
/
da_pra_terminar.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
60
61
62
63
64
65
#include <bits/stdc++.h>
using namespace std;
int main () {
int i, j, n, m, line, column;
cin >> n;
cin >> m;
char mat[n][m];
int mat2[n][m];
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
cin >> mat[i][j];
mat2[i][j] = 0;
}
}
cin >> line;
cin >> column;
for (i = line; i < n;) {
for (j = column; j < m;) {
if (mat2[i][j] == 1) {
cout << "EOQ";
return 0;
}
mat2[i][j] = 1;
if (mat[i][j] == 'L') {
j -= 1;
if (j < 0) {
cout << "AE MLK";
return 0;
}
}
if (mat[i][j] == 'R') {
j += 1;
if (j >= m) {
cout << "AE MLK";
return 0;
}
}
if (mat[i][j] == 'U') {
i -= 1;
if (i < 0) {
cout << "AE MLK";
return 0;
}
}
if (mat[i][j] == 'D') {
i += 1;
if (i >= n) {
cout << "AE MLK";
return 0;
}
}
}
}
return 0;
}