๐Ÿ˜Š ๋ฐฑ์ค€ 2217 : ๋กœํ”„

3Juhwanยท2021๋…„ 2์›” 27์ผ
0

Algorithm

๋ชฉ๋ก ๋ณด๊ธฐ
16/23

2217: ๋กœํ”„

Greedy ๋ฌธ์ œ์ด๋‹ค.
๊ฐ„๋‹จํ•œ ๋ฌธ์ œ๋ผ์„œ ๊ฐ„๋žตํ•˜๊ฒŒ ์ •๋ฆฌํ–ˆ๋‹ค.


๐Ÿ“Œ Try 1

N = int(input())
rope, _max = list(), 0

for _ in range(N):
  rope.append(int(input()))
rope.sort(reverse=True)

for i in range(N):
  weight = rope[i] * (i + 1)
  _max = _max if _max > weight else weight
  
print(_max)

profile
Codeforces์™€ USACO ํ’€์ด๋ฅผ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค. ์ด์ „ ๊ธ€๋„ ๊ณ„์† ์—…๋ฐ์ดํŠธ ๋ฉ๋‹ˆ๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€