cf965c Greedy Arkady

呸,大傻逼题,我更傻逼ref

#include <iostream>
using namespace std;
typedef long long ll;
ll n, k, m, d, ans;
int main(){
	cin>>n>>k>>m>>d;
	for(int i=1; i<=d; i++){
		ll x=n/(k*(i-1)+1);
		if(x==0)	break;
		x = min(x, m);
		ll tms=n/x;
		if(tms<(i-1)*k+1)	continue;
		ans = max(ans, i*x);
	}
	cout<<ans<<endl;
	return 0;
}
原文地址:https://www.cnblogs.com/poorpool/p/8977161.html