이호진
swea 1979 - 어디에 단어가 들어갈 수 있을까 - 2021/05/12 본문
T = int(input())
for test_case in range(1, T + 1):
n,m=map(int,input().split())
graph=[]
for i in range(n):
graph.append(list(map(int,input().split())))
count=0
for i in range(n):
current=0
for j in range(n):
if graph[i][j]==1:
current+=1
if graph[i][j]==0 or j==n-1:
if current==m:
count+=1
current=0
for j in range(n):
if graph[j][i]==1:
current+=1
if graph[j][i]==0 or j==n-1:
if current==m:
count+=1
current=0
print('#%d %d'%(test_case,count))
'SWEA문제풀이' 카테고리의 다른 글
swea 1970 - 쉬운 거스름돈 - 2021/05/12 (0) | 2021.05.12 |
---|---|
swea 1989 - 초심자의 회문 검사 - 2021/05/12 (0) | 2021.05.12 |
swea 2001 - 파리 퇴치 - 2021/05/12 (0) | 2021.05.12 |
swea 2007 - 패턴 마디의 길이 - 2021/05/11 (0) | 2021.05.11 |
swea 1926 - 간단한 369게임 - 2021/05/11 (0) | 2021.05.11 |