-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patha016.py
More file actions
35 lines (33 loc) · 908 Bytes
/
a016.py
File metadata and controls
35 lines (33 loc) · 908 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 2 22:59:22 2019
@author: sam0225
"""
while True:
try:
flag = True
matrix_9x9 = [input().split() for _ in range(9)]
for row in matrix_9x9:
if len(set(row)) < 9:
flag = False
break
for row in zip(*matrix_9x9):
if len(set(row)) < 9:
flag = False
break
flag = True
for i in range(0, 7, 3):
for j in range(0, 7, 3):
matrix_3x3 = matrix_9x9[i][j:j + 3] + matrix_9x9[i + 1][j:j + 3] + matrix_9x9[i + 2][j:j + 3]
# print(matrix_3x3)
if len(set(matrix_3x3)) < 9:
flag = False
break
if flag:
print("yes")
else:
print("no")
input()
except:
break