题目并不难,就是比赛的时候没敢去二分,也算是一个告诫,应该敢于思考……

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
long long n;
scanf("%I64d",&n);
long long left=,right=1e18,mid,num,m,s;
long long ans=-;
while(left<=right)
{
mid=(left+right)>>;
num = ;
for(long long i=;i <= ; i++)
{
m = i*i*i;
s=mid/m;
num+=s;
if(s==)break;
}
if(num==n)
ans=mid;
if(num>=n)
{
right=mid-;
}
else
{
left=mid+;
}
}
printf("%I64d\n",ans);
}

CodeForces 689C Mike and Chocolate Thieves (二分最大化最小值)的更多相关文章

  1. Codeforces 689C. Mike and Chocolate Thieves 二分

    C. Mike and Chocolate Thieves time limit per test:2 seconds memory limit per test:256 megabytes inpu ...

  2. CodeForces 689C Mike and Chocolate Thieves (二分+数论)

    Mike and Chocolate Thieves 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/G Description ...

  3. CodeForces 689C Mike and Chocolate Thieves (二分)

    原题: Description Bad news came to Mike's village, some thieves stole a bunch of chocolates from the l ...

  4. 689C - Mike and Chocolate Thieves 二分

    题目大意:有四个小偷,第一个小偷偷a个巧克力,后面几个小偷依次偷a*k,a*k*k,a*k*k*k个巧克力,现在知道小偷有n中偷法,求在这n种偷法中偷得最多的小偷的所偷的最小值. 题目思路:二分查找偷 ...

  5. codeforces 689C C. Mike and Chocolate Thieves(二分)

    题目链接: C. Mike and Chocolate Thieves time limit per test 2 seconds memory limit per test 256 megabyte ...

  6. Codeforces Round #361 (Div. 2) C. Mike and Chocolate Thieves 二分

    C. Mike and Chocolate Thieves 题目连接: http://www.codeforces.com/contest/689/problem/C Description Bad ...

  7. Codeforces Round #341 (Div. 2) C. Mike and Chocolate Thieves 二分

    C. Mike and Chocolate Thieves time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  8. POJ_2456_Agressive_cows_(二分,最大化最小值)

    描述 http://poj.org/problem?id=2456 有n个小屋,线性排列在不同位置,m头牛,每头牛占据一个小屋,求最近的两头牛之间距离的最大值. Aggressive cows Tim ...

  9. River Hopscotch(二分最大化最小值)

    River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9923   Accepted: 4252 D ...

随机推荐

  1. tomcat源码分析(一)

    tomcat的启动从Bootstrap类的main方法开始. public static void main(String args[]) { //单例 if (daemon == null) { d ...

  2. C#整理 条件语句

    条件语句主要分为if else语句和switch case语句. if else语句主要分为四种格式: 1. if(表达式) {} 2.二选一 if(表达式) {} else {} 3.多选一 if( ...

  3. UIKit继承结构和UIView.h文件详解

    @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem> ...

  4. python 九九乘法表!小练习

    # 1*1 = 1 # 1*2 = 2 2*2 = 4 # 1*3 = 3 2*3 = 6 3*3 = 9 i = 1 j = 1 for j in range(1,10): for i in ran ...

  5. 十、oracle 常用函数

    一.字符函数字符函数是oracle中最常用的函数,我们来看看有哪些字符函数:lower(char):将字符串转化为小写的格式.upper(char):将字符串转化为大写的格式.length(char) ...

  6. JSP之JavaBean

    一.定义 1 JavaBean是一个遵循特定写法的Java类,它通常具有如下特点: 这个Java类必须具有一个无参的构造函数 属性必须私有化. 私有化的属性必须通过public类型的方法暴露给其它程序 ...

  7. while循环与i--

    int i = 5;         while(i-- > 0){             System.out.println("i="+i);         } 打印 ...

  8. 【3】docker命令集

    root@xcc-VirtualBox:/home/xcc# docker --helpUsage: docker [OPTIONS] COMMAND [arg...]       docker [ ...

  9. Chapter 2 Open Book——2

    It was worse because I was tired; 更糟糕的是因为我疲惫了. I still couldn't sleep with the wind echoing around t ...

  10. MySQL安装--ubuntu

    1. 执行命令: $ apt-get install mysql-server 执行上述命令会自动安装mysql-client,mysql-common等包. 2. 安装过程中会让你给root账号设置 ...