t = int(input())
for i in range(t):
n,k = map(int,input().split())
lst = []
for j in range(n):
lst.append(list(map(int,input().split())))
ans = 0
for j in range(n):
check_w = 0
check_c = 0
gumsagi = 1
for h in range(n):
if h == (n-1) : gumsagi = 0
if lst[j][h] == 1 :
check_w = check_w + 1
if check_w == k and (lst[j][h+gumsagi] != 1 or h == n-1):
ans = ans + 1
else:
check_w = 0
if lst[h][j] == 1:
check_c = check_c + 1
if check_c == k and (lst[h+gumsagi][j] != 1 or h == n-1):
ans = ans + 1
else:
check_c = 0
print('#%d'%(i+1),ans)
'problem solving' 카테고리의 다른 글
1986. 지그재그 숫자 (0) | 2019.09.08 |
---|---|
1989. 초심자의 회문 검사 (0) | 2019.09.08 |
2001. 파리 퇴치 (0) | 2019.09.07 |
2005. 파스칼의 삼각형 (0) | 2019.09.07 |
2007. 패턴 마디의 길이 (0) | 2019.09.07 |
댓글