Skip to content

Commit fc4438c

Browse files
committed
[D2] Title: 스도쿠 검증, Time: 60 ms, Memory: 52,352 KB -BaekjoonHub
1 parent 26083e6 commit fc4438c

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# [D2] 스도쿠 검증 - 1974
2+
3+
[문제 링크](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5Psz16AYEDFAUq)
4+
5+
### 성능 요약
6+
7+
메모리: 52,352 KB, 시간: 60 ms, 코드길이: 1,113 Bytes
8+
9+
### 제출 일자
10+
11+
2026-05-13 15:50
12+
13+
14+
15+
> 출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
T = int(input())
2+
3+
for test_case in range(1, T + 1):
4+
5+
arr = []
6+
for _ in range(9):
7+
arr.append(list(map(int,input().split())))
8+
answer = 1
9+
10+
# 행
11+
for i in range(9):
12+
count_arr = [0] * 10
13+
for j in range(9):
14+
# 이미 카운팅 된 수라면
15+
if(count_arr[arr[i][j]] != 0):
16+
answer = 0
17+
else:
18+
count_arr[arr[i][j]] += 1
19+
20+
# 열
21+
for i in range(9):
22+
count_arr = [0] * 10
23+
for j in range(9):
24+
# 이미 카운팅 된 수라면
25+
if(count_arr[arr[j][i]] != 0):
26+
answer = 0
27+
else:
28+
count_arr[arr[j][i]] += 1
29+
30+
# 3*3
31+
for i in range(0,7,3):
32+
for j in range(0,7,3):
33+
count_arr = [0] * 10
34+
for x in range(i,i+3):
35+
for y in range(j,j+3):
36+
if(count_arr[arr[x][y]] != 0):
37+
answer = 0
38+
else:
39+
count_arr[arr[x][y]] += 1
40+
41+
print(f"#{test_case}",answer)
42+
43+
44+
# 모든 행, 열, 각 섹션의 사각형을 확인하면 된다.
45+
# 더 쉬운 방법이 있을까?

0 commit comments

Comments
 (0)