-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
45-tgyuuAn #162
45-tgyuuAn #162
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฌธ์ ํ๋ ๋ง๋๊ฒ ๋จน๊ณ ๊ฐ๋๋ค
๊ฐ๋ฏธ๊ตด์ด๋ ์
์ถ๋ ฅ ์ฒ๋ฆฌ๋ง ๋นผ๋ฉด ๋๊ฐ๋ค์
N = int(input())
tree = {}
for _ in range(N):
path = input().split('\\')
if path[0] not in tree:
tree[path[0]] = {}
node = tree[path[0]]
if len(path) > 1:
for p in range(1, len(path)):
if path[p] not in node:
node[path[p]] = {}
node = node[path[p]]
result = []
def dfs(node, depth):
for path in sorted(node.keys()):
indent = ' ' * depth
result.append(f"{indent}{path}")
dfs(node[path], depth + 1)
for root_path in sorted(tree.keys()):
result.append(root_path)
dfs(tree[root_path], 1)
for path in result:
print(path)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ ํ์คํ ์ ๋ฒ ๋ฌธ์ ์๋ ๊ฐ๋ฏธ๊ตด๊ณผ ๋น์ทํ๊ฒ ์ฝ๋๋ฅผ ์ง์
จ๋ค์!
๊ฐ๋ฏธ๊ตด ๊ตฌํํ ๋๋ ๋ค๋ฅธ ๋ ํผ๋ฐ์ค๋ฅผ ๋ณด๊ณ ์์ฑํ์
จ๋ ๊ฒ ๊ฐ์๋ฐ, ์ด๋ฒ์ ์๋ณด๊ณ ๊ตฌํํ์
จ๋ค๋ ๐๐๐๐
ํธ๋ผ์ด ๋ฌธ์ +1 ์ ๋ฆฝํ๊ณ ๊ฐ๋๋ค!
|
||
now = now.children[directory] | ||
|
||
def dfs(self, now : Node, depth): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ๋ถ๋ถ ๋ฌธ๋ฒ์ ์ฒ์๋ด์ ๋ ์ค์คํด๊ฐ๋๋น
๊ฐ์ฒด ํ์
์ ๋๊ฒจ์ค ๋๋ a :(๊ฐ์ฒด) ๋ก ์ ๋ฌํ๋ค ..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ์ด๊ฑด ์ฌ์ค ์์ผ๋ ์์ผ๋ ๊ด๋ จ์๋ ๋ฌธ๋ฒ์ธ๋ฐ,
์ ๋ ๊ฒ ํ์ ์ ๋ช ์ํด ์ค ๊ฒฝ์ฐ ๋ฉ์๋ ๋ด๋ถ์์ ํด๋น ๊ฐ์ฒด์ ํจ์๋ฅผ ide์์ ํธ์ถํด์ค ์ ์์ด์.
์๋ฅผ๋ค๋ฉด listํ์ ์ a๋ง ์ฐ๋ฉด append๊ฐ ๋ฆฌ์คํธ์ ๋์ค๋ ๊ฒ ์ฒ๋ผ..?
ํ์ด์ฌ์ ์ ๋ ๊ฒ ํ์ ๋ช ์ํด์ค๋ ๊ฐ์ ์ฑ์ด ์์ด์ ์ด๋ค ํ์ ์ด๋ ๋ฃ์ด์ค ์ ์์ด์!!
์ ์ ๋ ๋จนํ๊ณ ๊ฐ๋๋ค. ๊บผ์ต |
๐ ๋ฌธ์ ๋งํฌ
๋์คํฌ ํธ๋ฆฌ
โ๏ธ ์์๋ ์๊ฐ
30๋ถ
โจ ์๋ ์ฝ๋
๋ฌธ์ ํ ๋ฒ๋ง ๋ ๋ก ๋จน๊ฒ ์๋๋ค ํํ..
ํธ๋ผ์ด ์๋ฃ๊ตฌ์กฐ๋ฅผ ๊ณต๋ถํ ๋ผ๊ณ ํธ๋ผ์ด์์ ์๋ฌด๊ฑฐ๋ ๊ณจ๋๋๋ฐ,
#159 (comment) ๋ฌธ์ ๋ ํ์ด๊ฐ ์์ ๋์ผํด์..
๊ทผ๋ฐ ์ด์ ์ ๋ณด๊ณ ๊ตฌํํ..
ํ์ด๊ฐ ์ ๋ฒ ์ฐจ์๋ ๋์ผํด์ ์ด๋ฒ ํ ๋ฒ๋ง ๋ ๋จนํ๊ฒ ์๋๋ค.
๋ฉด์ ์ค๋นํ๊ณ ๋ฉด์ ๋ณด๊ณ ์์ง๋์~~~
๋ด์ฃผ3yo~~~~~~~~~~~
๐ ์๋กญ๊ฒ ์๊ฒ๋ ๋ด์ฉ