[๋ฐฑ์ค 11399] [greedy] ATM ๋ฐฑ์ค 11399๋ฒ [ATM] ํ์ด) n = int(input()) lst = sorted(list(map(int,input().split(' ')))) cnt = 0 for i in range(n,0,-1) : cnt += i*lst[len(lst)-i] print(cnt) ๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค/greedy 2021.04.17
[๋ฐฑ์ค 2839] [greedy] ์คํ๋ฐฐ๋ฌ ๋ฐฑ์ค 2839๋ฒ [์คํ๋ฐฐ๋ฌ] ํ์ด) n=int(input()) cnt = 0 for x in range(n//5,-1,-1) : n_ = n - (5*x) if n_%3 == 0 : cnt+= (n_//3) cnt+= x print(cnt) break if cnt == 0 : print(-1) ๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค/greedy 2021.04.17