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