-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Refleksi_Matriks.cpp
87 lines (78 loc) · 1.56 KB
/
A_Refleksi_Matriks.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 75;
int n;
int a[N][N], b[N][N], c[N][N];
bool identic(int a[][N], int b[][N]) {
bool c=true;
for(int l=0;l<n && c;l++){
for(int j=0;j<n && c;j++){
if(a[l][j]!=b[l][j]){
c = false;
}
}
}
return c;
}
int main(){
cin >> n >> n;
for(int l=0;l<n;l++){
for(int j=0;j<n;j++){
cin >> a[l][j];
}
}
cin >> n >> n;
for(int l=0;l<n;l++){
for(int j=0;j<n;j++){
cin >> b[l][j];
}
}
// Identical
if(identic(a, b)){
cout << "identik";
return 0;
}
// Vertical
for(int j=0;j<n;j++){
for(int l=0;l<n;l++){
c[l][j] = b[l][n-j-1];
}
}
if(identic(a, c)){
cout << "vertikal";
return 0;
}
// Horizontal
for(int l=0;l<n;l++){
for(int j=0;j<n;j++){
c[l][j] = b[n-l-1][j];
}
}
if(identic(a, c)){
cout << "horisontal";
return 0;
}
// Right-Bottom Diagonal
for(int l=0;l<n;l++){
for(int j=0;j<n;j++){
c[l][j] = b[j][l];
}
}
if(identic(a, c)){
cout << "diagonal kanan bawah";
return 0;
}
// Left-Bottom Diagonal
for(int l=0;l<n;l++){
for(int j=0;j<n;j++){
c[l][j] = b[n-j-1][n-l-1];
}
}
if(identic(a, c)){
cout << "diagonal kiri bawah";
return 0;
}
// Nothing
cout << "tidak identik";
}