#include #include #include #include using namespace std; using namespace atcoder; using namespace __gnu_pbds; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using pll=pair; // using mint=modint; // template // using ordered_map=tree,rb_tree_tag,tree_order_statistics_node_update>; bool dp[105][15][1005]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,D,K; cin>>N>>D>>K; // dp[i][k][s]: // i円, i+1円, ..., N円のお菓子から // ちょうどk個選んで、合計s円にできるか dp[N+1][0][0]=true; for(int i=N;i>=1;--i){ for(int k=0;k<=K;++k){ for(int s=0;s<=D;++s){ dp[i][k][s]=false; if(dp[i+1][k][s])dp[i][k][s]=true; if(k-1>=0&&s-i>=0&&dp[i+1][k-1][s-i])dp[i][k][s]=true; } } } if(!dp[1][K][D]){ cout<<-1<=0&&needD-i>=0&&dp[i+1][needK-1][needD-i])needK--,needD-=i,ans.push_back(i); } for(int i=0;i