백준 문제 풀이
백준 2210 파이썬 python : 숫자판 점프 @@황소처럼 우직하게@@ 좋은사람만나 사랑받고
hjp845
2020. 4. 23. 14:23
반응형
얼굴붉히며 딴청피던 아름답던 그 때 처럼..
mat = []
for i in range(5):
mat.append(list(input().split()))
lst = []
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]
def go(y, x, cnt, rst):
rst += mat[y][x]
cnt += 1
if cnt == 6:
lst.append(rst)
return
for i in range(4):
ny = y + dy[i]
nx = x + dx[i]
if 0 <= nx < 5 and 0 <= ny < 5:
go(ny, nx, cnt, rst)
for i in range(5):
for j in range(5):
go(i, j, 0, '')
print(len(set(lst)))
반응형