board = []
coord = []
memo = []
count = 0
for i in range(19): # 바둑판 생성
board.append(list(map(int, input().split())))
def findcorrd(num):
for y in range(19):
for x in range(19):
if board[y][x] == num:
coord.append([y, x])
def side(data, num, dx, dy):
y = data[0]
x = data[1]
if x == 19 or y == 19 or x < 0 or y < 0:
return 0
if data in memo:
return 0
if board[y+dy][x+dx] == num:
memo.append(data)
return 1+side([y+dy,x+dx], num, dx, dy)
else:
return 0
def reset():
global memo
global count
memo = []
if count != 5:
count = 0
def main(num):
global memo
global count
findcorrd(num)
for i in coord:
count = side(i, num, 0, 1)
reset()
count = side(i, num, 1, 0)
reset()
count = side(i, num, 1, 1)
reset()
count = side(i, num, 1, -1)
main(1)
print(count)
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
211016
211016
댓글 0개
좋아요
댓글(0)
bottom of page