-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadivinhe_o_padrao.cpp
More file actions
44 lines (36 loc) · 858 Bytes
/
adivinhe_o_padrao.cpp
File metadata and controls
44 lines (36 loc) · 858 Bytes
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
#include <iostream>
using namespace std;
int main() {
int n, m, pattern1, pattern2, pattern3;
cin >> n;
cin >> m;
long long int mat[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> mat[i][j];
}
}
for (int j = 0; j < m; j++) {
pattern1 = 0;
pattern2 = 0;
pattern3 = 0;
for (int i = 1; i < n; i++) {
if (mat[i][j] > mat[i-1][j]) {
pattern1++;
}
else if (mat[i][j] == mat[i-1][j]) {
pattern2++;
}
else {
pattern3++;
}
}
if (pattern1 == n - 1 || pattern2 == n - 1 || pattern3 == n - 1) {
cout << 'S' << endl;
}
else {
cout << 'N' << endl;
}
}
return 0;
}