src2020/4065_returnmoney/returnmoney.cpp

23 lines
407 B
C++
Raw Normal View History

2020-04-01 17:51:43 +08:00
#include<iostream>
using namespace std;
long long n,k,m;
bool pan(long long now,long long x){
long long y=now/x;
if(y<x){
y=m;
}
now-=y;
}
long long dg(long long t,long long w) {
long long mid=(w-t)/2+t;
if(pan(n,mid)==1){
return dg(mid+1,w);
}else{
return dg(t,mid-1);
}
}
int main(){
cin>>n>>k>>m;
cout<<dg(1,n);
}