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

83-tgyuuAn #259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

83-tgyuuAn #259

wants to merge 2 commits into from

Conversation

tgyuuAn
Copy link
Member

@tgyuuAn tgyuuAn commented Dec 1, 2024

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

์นตํ…Œ์ผ

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

40๋ถ„

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

image

ํŒŒ์šฐ์ŠคํŠธ ๋จน๊ณ ์‹ถ๋‹ค ,,




๋ฌธ์ œ๋Š” ์„ธ์ƒ์—์„œ ์ ค ๋ง›์žˆ๋Š” ์นตํ…Œ์ผ august14๋ฅผ ๋งŒ๋“ค๊ธฐ์œ„ํ•ด ๋“ค์–ด๊ฐ€๋Š” ์žฌ๋ฃŒ๊ฐ€ ์ตœ๋Œ€ 10๊ฐœ ์ฃผ์–ด์ง€๋Š”๋ฐ,

์ด ์žฌ๋ฃŒ๋“ค ๊ฐ„์— ๋น„์œจ์ด ์ฃผ์–ด์ง„๋‹ค.

์ด ๋น„์œจ๋“ค์„ ์ด์šฉํ•ด์„œ augutst14์˜ ๋น„์œจ์„ ๊ฐ€์žฅ ์ ์€ ๊ฐ’์˜ ์กฐํ•ฉ์œผ๋กœ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค.

(์˜ˆ๋ฅผ ๋“ค์–ด A, B, C์˜ ์กฐํ•ฉ์ด 2:4:6์œผ๋กœ ๋“ค์–ด๊ฐ”๋‹ค๋ฉด ์ด๋ฅผ 1:2:3์œผ๋กœ ์ถœ๋ ฅํ•ด์•ผ ํ•จ.)




์žฌ๋ฃŒ๊ฐ€ ์ตœ๋Œ€ 10๊ฐœ๋ฐ–์— ๋˜์ง€ ์•Š์•„์„œ, ์™„์ „ ํƒ์ƒ‰์œผ๋กœ ํ’€ ์ˆ˜ ์žˆ๋‹ค.

ํ‘ธ๋Š” ๋ฐฉ๋ฒ•์€ ๋งค์šฐ ๊ฐ„๋‹จํ•œ๋ฐ,

์•„๋ž˜ ์ฒ˜๋Ÿผ ํ•œ ์ค„ ์”ฉ ์žฌ๋ฃŒ 2๊ฐœ์˜ ๋น„์œจ์ด ๋‚˜์˜ฌ ๊ฒฝ์šฐ,

5
4 0 1 1
4 1 3 1
4 2 5 1
4 3 7 1

4๋ฒˆ ์žฌ๋ฃŒ์™€ 0๋ฒˆ ์žฌ๋ฃŒ์˜ ๋น„์œจ์ด 1:1๋กœ ๋จผ์ € ์ฃผ์–ด์กŒ๋‹ค.

์ด ๋•Œ, Linked๋ผ๋Š” Dictionary์— 4๋ฒˆ์ด 0๋ฒˆ๊ณผ ์—ฐ๊ฒฐ๋˜์–ด์žˆ๋‹ค๋Š” ์ •๋ณด๋ฅผ ๋‹ด์•„์ค€๋‹ค.

// ์•„๋ž˜ ์ฝ”๋“œ๊ฐ€ ๋‘˜์ด ์„œ๋กœ ์—ฐ๊ฒฐ๋˜์–ด์žˆ๋‹ค๋Š” ์ •๋ณด์ž„
// ํŒŒ์ด์ฌ์œผ๋กœ ์งœ๋„ ๊ทธ๋ƒฅ Dictionary์— ์„œ๋กœ์„œ๋กœ์˜ list์— ์ถ”๊ฐ€ํ•ด์ฃผ๋Š” ๊ฒƒ์ž„
        linked[a].add(b)
        linked[b].add(a)




๊ทธ๋ฆฌ๊ณ  ๊ทธ ๋‹ค์Œ ๋ ˆ์‹œํ”ผ์ธ 4๋ฒˆ ์žฌ๋ฃŒ์™€ 1๋ฒˆ ์žฌ๋ฃŒ๊ฐ€ 3:1 ๋กœ ์„ž์ธ๋‹ค๊ณ  ์ฃผ์–ด์กŒ์„ ๋•Œ,

๋‘˜์˜ ๋น„์œจ์„ ๊ฐฑ์‹ ํ•ด์ฃผ๊ธฐ ์ „์— ๋‘˜์˜ ์กฐํ•ฉ ๋น„์œจ์˜ ์ตœ์†Œ๊ฐ’์„ ๊ตฌํ•ด์ค€๋‹ค.

์˜ˆ๋ฅผ ๋“ค๋ฉด 6:2๋ผ๋Š” ๋น„์œจ๋กœ ์ฃผ์–ด์กŒ์„ ๋•Œ ์ด๋ฅผ 3:1๋กœ ์ค„์—ฌ์ค˜์•ผ ํ•จ.

์ด๋Š” ๋‘ ๋น„์œจ์˜ ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๋ฅผ ๊ตฌํ•ด์„œ ๊ฐ๊ฐ ๋‚˜๋ˆ ์ฃผ๋ฉด ๋จ.




๊ทธ๋ฆฌ๊ณ , ๊ธฐ์กด์— ๊ตฌํ•ด์ ธ์žˆ๋˜ ๋น„์œจ์— ์ƒˆ๋กญ๊ฒŒ ์ถ”๊ฐ€๋œ ๋น„์œจ์„ ๊ณฑํ•ด์ฃผ๋ฉด ๋˜๋Š”๋ฐ,

์žฌ๋ฃŒ์™€ ์—ฐ๊ฒฐ๋œ ์žฌ๋ฃŒ๋“ค์„ ์—ฐ์‡„์ ์œผ๋กœ ๊ณฑํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ์œ„์—์„œ 0๋ฒˆ ์žฌ๋ฃŒ์™€ 4๋ฒˆ ์žฌ๋ฃŒ๊ฐ€ 1:1 ๋กœ ์„ž์—ฌ์žˆ๊ณ ,

์ถ”๊ฐ€์ ์œผ๋กœ 1๋ฒˆ ์žฌ๋ฃŒ์™€ 4๋ฒˆ์žฌ๋ฃŒ๊ฐ€ 3:1๋กœ ์„ž์ด๋ฏ€๋กœ,

0๋ฒˆ ์žฌ๋ฃŒ์™€ 4๋ฒˆ์žฌ๋ฃŒ์— 3์„ ๊ณฑํ•ด์ฃผ๋ฉด ๋œ๋‹ค๋Š” ์†Œ๋ฆฌ์ด๋‹ค.




๋˜ํ•œ ์ฃผ์˜ํ•ด์•ผํ•  ์ ์ด

B์™€ C์žฌ๋ฃŒ๋ฅผ ์„ž์œผ๋ ค๊ณ  ํ•  ๋•Œ,

B์™€ C์žฌ๋ฃŒ๊ฐ€ 1:1 ๋น„์œจ๋กœ ์„ž์ธ๋‹ค๊ณ  ํ•ด๋ณด์ž.

๊ธฐ์กด์— B๋Š” ๋‹ค๋ฅธ ์žฌ๋ฃŒ์™€์˜ ๋ ˆ์‹œํ”ผ๋ฅผ ํ†ตํ•ด 5์˜ ๋น„์œจ๋กœ ๋จผ์ € ๋“ค์–ด๊ฐ€์žˆ๋‹ค๊ณ  ํ•˜๋ฉด

B์žฌ๋ฃŒ๋Š” C์žฌ๋ฃŒ์˜ ๊ธฐ์กด ๋น„์œจ์ธ 5๋ฅผ ๊ณฑํ•ด์ค˜์•ผํ•œ๋‹ค.


์˜ˆ๋ฅผ ๋“ค์–ด A์™€ B๊ฐ€ 1:5๋กœ ์„ž์ธ๋‹ค๊ณ  ํ•ด๋ณด์ž,

๊ทธ๋ฆฌ๊ณ  B์™€ C๊ฐ€ 1:1๋กœ ์„ž์ธ๋‹ค๊ณ  ํ•ด๋ณด์ž.

๊ทธ๋Ÿผ A์™€ B์˜ ๋น„์œจ์€ 1:5๋กœ ํ˜•์„ฑ๋œ ์ดํ›„ B์™€ C ๋ ˆ์‹œํ”ผ๊ฐ€ ์ถ”๊ฐ€๋˜๋ฉด์„œ 1:5:5๋กœ C๊ฐ€ B์˜ ๊ธฐ์กด ๋น„์œจ 5๋งŒํผ์„ ๊ณฑํ•ด์ค˜์•ผํ•œ๋‹ค.




์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๋ฅผ ๊ตฌํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์œ ํด๋ฆฌ๋“œ ํ˜ธ์ œ๋ฒ•์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค.

์œ ํด๋ฆฌ๋“œ ํ˜ธ์ œ๋ฒ•์„ ๋งŒ์•ฝ ๋ชจ๋ฅด๊ณ  ์žˆ๋”๋ผ๋ฉด ๋ฐ˜๋“œ์‹œ ์ˆ™์ง€ํ•ด์•ผ ํ•˜๋ฉฐ,

์œ ํด๋ฆฌ๋“œ ํ˜ธ์ œ๋ฒ•์œผ๋กœ ๊ตฌํ•œ ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜๋ฅผ ํ†ตํ•ด ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜๋„ ๊ตฌํ•  ์ˆ˜ ์žˆ๋‹ค.

A, B์˜ ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๊ฐ€ C๋ผ๊ณ  ํ•  ๋•Œ A์™€ B์˜ ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜๋Š” (A*B)/C ๊ฐ€ ๋œ๋‹ค.

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

@tgyuuAn tgyuuAn added tgyuuAn ํ•œ ์ค„๋กœ๋Š” ์†Œ๊ฐœํ•  ์ˆ˜ ์—†๋Š” ๋‚จ์ž. ์ž‘์„ฑ ์ค‘ โฑ๏ธ labels Dec 1, 2024
@tgyuuAn tgyuuAn requested a review from H0ngJu December 1, 2024 09:24
@tgyuuAn tgyuuAn self-assigned this Dec 1, 2024
@tgyuuAn tgyuuAn marked this pull request as ready for review December 3, 2024 12:36
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.

1 participant