[๋ฐฑ์ค 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