#include #include #include #include #include int sigma(int begin, int end, std::function func){ if(begin>end) return 0; int ans=0; for(int i=begin; i<=end; ++i){ ans+=func(i); } return ans; } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); //input int n, d, k; std::cin >> n >> d >> k; //solve auto func = [](int x){return x;}; if(d-sigma(1, k-1, func) value(k); for(int i=k-1; i>=0; --i){ int rest = d-sigma(1, i, func); if(rest<=n-k+i){ for(int j=0; j