-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1005.cpp
90 lines (75 loc) · 1.3 KB
/
1005.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
88
89
90
#include <iostream>
using namespace std;
int n;
bool check[12];
short data[12][12];
short sum[12][12];
int main() {
cin >> n;
bool flag;
while (n>0) {
n--;
flag = true;
for (int i=1; i<=9; i++) {
for (int j=1; j<=9; j++)
cin >> data[i][j];
}
/*
for (i=1; i<=10; i++) {
for (j=1; j<=10; j++)
sum[i][j] = data[i][j] + sum[i]
}
*/
for (int i=1; i<=9; i++)
if (flag) {
for(int j=1; j<=9; j++)
check[j] = false;
for(int j=1; j<=9; j++)
if (!check[data[i][j]]) {
check[data[i][j]] = true;
}
else {
flag = false;
break;
}
}
for (int i=1; i<=9; i++)
if (flag) {
for(int j=1; j<=9; j++)
check[j] = false;
for(int j=1; j<=9; j++)
if (!check[data[j][i]]) {
check[data[j][i]] = true;
}
else {
flag = false;
break;
}
}
for (int t=1; t<=9; t+=3) {
for (int k=1; k<=9; k+=3) {
for(int j=1; j<=9; j++)
check[j] = false;
for (int i=0; i<3; i++)
if (flag) {
for (int j=0; j<3; j++) {
if (!check[data[i+t][j+k]]) {
check[data[i+t][j+k]] = true;
}
else {
flag = false;
break;
}
}
}
}
}
if (flag) {
cout << "Right" << endl;
}
else {
cout << "Wrong" << endl;
}
}
return 0;
}