标签:pre focus expand pen long 函数 代码 htm style
https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/B
分析:
参考大佬题解:https://www.cnblogs.com/BrianPeng/p/12284076.html
代码:
#include <cstdio> #include <algorithm> #include <iostream> using namespace std; typedef long long ll; ll t,re,y; ll n,m,k; bool judge(ll x) { t=k,re=n; while(t>0&&re>0) { y=re/x; ll a=re/y-x+1; if(a>=t) a=t; if(y>m) re-=y*a,t-=a; else re-=m*t,t=0; } return re<=0; } int main() { scanf("%lld%lld%lld",&n,&k,&m); ll l=1,r=n; ll mid=(l+r)>>1; while(l<r) { mid=(l+r)>>1; if(judge(mid)) l=mid+1; else r=mid; } cout<<l-1<<endl; return 0; }
标签:pre focus expand pen long 函数 代码 htm style
原文地址:https://www.cnblogs.com/studyshare777/p/12404928.html