๐ฆ๐ฑ๐ฌ๐ด๐ท๐ฎ๐น๐ญ๐ฒ
2023. 2. 9.
[์ด์ฝํ
] ๊ทธ๋ฆฌ๋(Greedy)
์ฐธ๊ณ ์๋ฃ: ์ด๊ฒ์ด ์ฝ๋ฉ ํ
์คํธ๋ค with ํ์ด์ฌ ๊ทธ๋ฆฌ๋ (Greedy) ๐ก ํ์ฌ ์ํฉ์์ ์ง๊ธ ๋น์ฅ ์ข์ ๊ฒ๋ง ๊ณ ๋ฅด๋ ๋ฐฉ๋ฒ → ํ์๋ฒ ์์ - ๊ฑฐ์ค๋ฆ๋ n = 1260 count = 0 coin_types = [500,100,50,10] for coin in coin_types: count += n // coin n %= coin print(count) โ ๊ฐ์ฅ ํฐ ํํ ๋จ์๋ถํฐ ๋์ ๊ฑฐ์ฌ๋ฌ ์ฃผ๋ ๊ฒ ํฐ ์์ ๋ฒ์น n, m, k = map(int, input().split()) data = list(map(int, input().split())) data.sort() first = data[n-1] second = data[n-2] result = 0 while True: for i in range(k)..