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