From ea0eac657c19d13479e4b32238dc80d27372749a Mon Sep 17 00:00:00 2001 From: aeyongdodam <93649914+aeyongdodam@users.noreply.github.com> Date: Wed, 23 Nov 2022 19:33:45 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=8B=A4=ED=8C=A8]1123=5F=EC=B4=88=EC=A4=91?= =?UTF-8?q?=EA=B8=89=5F=EC=9D=B4=EC=86=8C=ED=98=84(8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1917029 - 10971.py" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "11\354\233\22423\354\235\274/\354\264\210\354\244\221\352\270\211/1917029 - 10971.py" diff --git "a/11\354\233\22423\354\235\274/\354\264\210\354\244\221\352\270\211/1917029 - 10971.py" "b/11\354\233\22423\354\235\274/\354\264\210\354\244\221\352\270\211/1917029 - 10971.py" new file mode 100644 index 0000000..735939e --- /dev/null +++ "b/11\354\233\22423\354\235\274/\354\264\210\354\244\221\352\270\211/1917029 - 10971.py" @@ -0,0 +1,26 @@ +import sys +li=[] +n=int(sys.stdin.readline()) +ans=[] +for i in range(n): + tmp=list(map(int, sys.stdin.readline().split())) + li.append(tmp) +def dfs(i, start, cost,note): + global ans + if note.count(1)==n: + if li[i][start]!=0: + ans.append(cost+li[i][start]) + return + for j in range(n): + if note[j]==0 and li[i][j] != 0: + cost+=li[i][j] + note[j]=1 + dfs(j,start, cost,note) + note[j]=0 + +for i in range(n): + cost=0 + note=[0]*n + note[i]=1 + dfs(i,i, cost, note) +print(min(ans))