CodeForces 689C【二分】

转自:
http://blog.csdn.net/qq_26071477/article/details/51892995

#include<stdio.h>
typedef long long ll;
ll check(ll n)
{
    ll res=0;
    for(ll k=2; k*k*k<=n; k++)//k是ll范围  不可犯糊涂 
        res+=n/(k*k*k);
    return res;
}
int main()
{
    ll m,res=-1,l=1,r=1e18,mid;
    scanf("%I64d",&m);
    while(r>=l)
    {
        mid=(l+r)/2;
        ll num= check(mid);
        if(num==m)
            res=mid;
        if(num>=m)
            r=mid-1;
        else
            l=mid+1;
    }
    printf("%I64d\n",res);
}
posted @ 2016-09-20 22:26  see_you_later  阅读(158)  评论(0编辑  收藏  举报