23 lines
407 B
C++
23 lines
407 B
C++
|
#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);
|
||
|
}
|