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;
}
posted @ 2018-05-01 19:35  poorpool  阅读(439)  评论(0编辑  收藏  举报