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);
}
CodeForces 689C【二分】的更多相关文章
- Codeforces 689C. Mike and Chocolate Thieves 二分
C. Mike and Chocolate Thieves time limit per test:2 seconds memory limit per test:256 megabytes inpu ...
- CodeForces 689C Mike and Chocolate Thieves (二分)
原题: Description Bad news came to Mike's village, some thieves stole a bunch of chocolates from the l ...
- CodeForces 689C Mike and Chocolate Thieves (二分+数论)
Mike and Chocolate Thieves 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/G Description ...
- CodeForces 689C Mike and Chocolate Thieves (二分最大化最小值)
题目并不难,就是比赛的时候没敢去二分,也算是一个告诫,应该敢于思考…… #include<stdio.h> #include<iostream> using namespace ...
- codeforces 689C C. Mike and Chocolate Thieves(二分)
题目链接: C. Mike and Chocolate Thieves time limit per test 2 seconds memory limit per test 256 megabyte ...
- CodeForces - 363D --二分和贪心
题目:CodeForces - 363D 题意:给定n个学生,其中每个学生都有各自的私己钱,并且自己的私己钱只能用在自己买自行车,不能给别人. 给定m个自行车,每个自行车都有一个价格. 给定公有财产a ...
- Codeforces Round #425 (Div. 2) Problem C Strange Radiation (Codeforces 832C) - 二分答案 - 数论
n people are standing on a coordinate axis in points with positive integer coordinates strictly less ...
- Codeforces 732D [二分 ][贪心]
/* 不要低头,不要放弃,不要气馁,不要慌张 题意: n天进行m科考试,每科考试需要a的复习时间,n天每天最多可以考一科.并且指定哪天考哪科. 注意考试那天不能复习. 问最少需要多少天可全部通过考试. ...
- codeforces 359D 二分答案+RMQ
上学期刷过裸的RMQ模板题,不过那时候一直不理解>_< 其实RMQ很简单: 设f[i][j]表示从i开始的,长度为2^j的一段元素中的最小值or最大值 那么f[i][j]=min/max{ ...
随机推荐
- C++代码书写模板 -- 如何判断函数类型
先说一个简单的方案. 经过验证 g++ 和 vs2010 都可以.原理就是利用函数类型可以直接转换成函数指针. template<class T> bool test( T * t ) { ...
- 使用kbmmw 的调度事件动态显示时间
kbmmw 里面提供了强大的事件调度功能,今天简单演示一个使用调度事件在窗体上显示时间. 建立一个新工程. 放上几个控件 在窗体里面引用单元 kbmMWScheduler, 然后添加过程 unit U ...
- 【BZOJ2625】[Neerc2009]Inspection 最小流
[BZOJ2625][Neerc2009]Inspection Description You are in charge of a team that inspects a new ski reso ...
- EasyRTMP直播推送效率优化之开源librtmp CPU占用高效率优化
本文转自EasyDarwin开源团队Kim的博客:http://blog.csdn.net/jinlong0603/article/details/52950948 EasyRTMP 前面介绍过Eas ...
- 2018.11.23-day27 面向对象(大总结)
1. 2个内置函数 2.反射 3.内置方法 4.面向对象大总结 思维导图地址:https://www.processon.com/view/link/5bfcfd62e4b0ef094cbf04a7 ...
- Composite Pattern
1.将对象组合成树形结构以表示“部分--整体”的层次结构.组合模式使得用户对单个对象和组合对象的使用具有一致性. 2.Composite 模式结构图 3.实现 #ifndef _COMPONENT_H ...
- UVA 11752 The Super Powers —— 数学与幂
题目链接:https://vjudge.net/problem/UVA-11752 题解: 1.首先变量必须用unsig long long定义. 2.可以分析得到,当指数为合数的时候,该值合法. 3 ...
- windows下的host文件在哪里,有什么作用?
在Window系统中有个Hosts文件(没有后缀名),在Windows98系统下该文件在Windows目录,在Windows2000/XP系统中位于C:\Winnt\System32\Drivers\ ...
- 如何查看智能手机的IP地址
1. 外网IP IP地址可简单分为两类.外网IP或称公网IP是用来在Internet上唯一标识你的设备的.如果你通过GPRS或者3G技术接入互联网的话(通过运营商网络),那么你也可以通过下面的方 ...
- Mac开发快速入门
初次接触mac开发,发现国内相关资料少得可怜,于是写下这篇文章,作为学习记录.Mac应用开发也是使用Objective-C进行开发的,所以从iOS转Mac并不困难,很多东西都一样. 本文以一个登录界面 ...