Skip to content
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

Merged
merged 2 commits into from
Mar 24, 2024
Merged

45-tgyuuAn #162

merged 2 commits into from
Mar 24, 2024

Conversation

tgyuuAn
Copy link
Member

@tgyuuAn tgyuuAn commented Mar 16, 2024

๐Ÿ”— ๋ฌธ์ œ ๋งํฌ

๋””์Šคํฌ ํŠธ๋ฆฌ

โœ”๏ธ ์†Œ์š”๋œ ์‹œ๊ฐ„

30๋ถ„

โœจ ์ˆ˜๋„ ์ฝ”๋“œ

๋ฌธ์ œ ํ•œ ๋ฒˆ๋งŒ ๋‚ ๋กœ ๋จน๊ฒ ์”๋‹ˆ๋‹ค ํ•˜ํ•˜..

ํŠธ๋ผ์ด ์ž๋ฃŒ๊ตฌ์กฐ๋ฅผ ๊ณต๋ถ€ํ• ๋ผ๊ณ  ํŠธ๋ผ์ด์—์„œ ์•„๋ฌด๊ฑฐ๋‚˜ ๊ณจ๋ž๋Š”๋ฐ,

#159 (comment) ๋ฌธ์ œ๋ž‘ ํ’€์ด๊ฐ€ ์™„์ „ ๋™์ผํ•ด์š”..







๊ทผ๋ฐ ์ด์ œ ์•ˆ ๋ณด๊ณ  ๊ตฌํ˜„ํ•œ..







ํ’€์ด๊ฐ€ ์ €๋ฒˆ ์ฐจ์‹œ๋ž‘ ๋™์ผํ•ด์„œ ์ด๋ฒˆ ํ•œ ๋ฒˆ๋งŒ ๋‚ ๋จนํ•˜๊ฒ ์”๋‹ˆ๋‹ค.

๋ฉด์ ‘ ์ค€๋น„ํ•˜๊ณ  ๋ฉด์ ‘ ๋ณด๊ณ  ์™“์งœ๋‚˜์š”~~~

๋ด์ฃผ3yo~~~~~~~~~~~

๐Ÿ“š ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ๋œ ๋‚ด์šฉ

@tgyuuAn tgyuuAn added tgyuuAn ํ•œ ์ค„๋กœ๋Š” ์†Œ๊ฐœํ•  ์ˆ˜ ์—†๋Š” ๋‚จ์ž. ์ž‘์„ฑ ์ค‘ โฑ๏ธ labels Mar 16, 2024
@tgyuuAn tgyuuAn self-assigned this Mar 16, 2024
@tgyuuAn tgyuuAn marked this pull request as ready for review March 16, 2024 16:01
Copy link
Collaborator

@pknujsp pknujsp left a 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)

Copy link
Collaborator

@H0ngJu H0ngJu left a 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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„ ๋ฌธ๋ฒ•์„ ์ฒ˜์Œ๋ด์„œ ๋˜ ์ค์คํ•ด๊ฐ‘๋‹ˆ๋‹น
๊ฐ์ฒด ํƒ€์ž…์„ ๋„˜๊ฒจ์ค„ ๋•Œ๋Š” a :(๊ฐ์ฒด) ๋กœ ์ „๋‹ฌํ•œ๋‹ค ..!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•… ์ด๊ฑด ์‚ฌ์‹ค ์žˆ์œผ๋‚˜ ์—†์œผ๋‚˜ ๊ด€๋ จ์—†๋Š” ๋ฌธ๋ฒ•์ธ๋ฐ,

์ €๋ ‡๊ฒŒ ํƒ€์ž…์„ ๋ช…์‹œํ•ด ์ค„ ๊ฒฝ์šฐ ๋ฉ”์†Œ๋“œ ๋‚ด๋ถ€์—์„œ ํ•ด๋‹น ๊ฐ์ฒด์˜ ํ•จ์ˆ˜๋ฅผ ide์—์„œ ํ˜ธ์ถœํ•ด์ค„ ์ˆ˜ ์žˆ์–ด์š”.

์˜ˆ๋ฅผ๋“ค๋ฉด listํƒ€์ž…์— a๋งŒ ์“ฐ๋ฉด append๊ฐ€ ๋ฆฌ์ŠคํŠธ์— ๋‚˜์˜ค๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ..?

ํŒŒ์ด์ฌ์€ ์ €๋ ‡๊ฒŒ ํƒ€์ž… ๋ช…์‹œํ•ด์ค˜๋„ ๊ฐ•์ œ์„ฑ์ด ์—†์–ด์„œ ์–ด๋–ค ํƒ€์ž…์ด๋˜ ๋„ฃ์–ด์ค„ ์ˆ˜ ์žˆ์–ด์š”!!

@Munbin-Lee
Copy link
Member

์ ์ˆ˜ ๋‚ ๋จนํ•˜๊ณ  ๊ฐ‘๋‹ˆ๋‹ค.

๊บผ์–ต

@tgyuuAn tgyuuAn merged commit 9f48183 into main Mar 24, 2024
@tgyuuAn tgyuuAn deleted the 45-tgyuuAn branch March 24, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tgyuuAn ํ•œ ์ค„๋กœ๋Š” ์†Œ๊ฐœํ•  ์ˆ˜ ์—†๋Š” ๋‚จ์ž. ๋ฆฌ๋ทฐ ์™„๋ฃŒ โœ”๏ธ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants