def scan; gets.split.map(&:to_i); end n,d,k = scan @memo={} def dfs(n,d,k) return d == 0 if k == 0 return false if d <= 0 return false if n <= 0 key = [n,d,k] return false if @memo[key] n.downto(1){|coin| if dfs(coin-1,d-coin,k-1) printf "%d ",coin return true end } @memo[key] = true return false end puts "-1" unless dfs(n,d,k)