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{ ...
随机推荐
- python staticmethod和classmethod(转载)
staticmethod, classmethod 分别被称为静态方法和类方法. staticmethod 基本上和一个全局函数差不多,只不过可以通过类或类的实例对象(python里只说对象总是容易产 ...
- Python使用Mysql过程中一些错误
Python使用Mysql过程中一些错误 ssh登录远程服务器 ssh ubuntu@xxx.xxx.xx.xx 第一:ubuntu终端中登录Mysql mysql -uroot -p 然后输入密码即 ...
- session.use_cookies有什么作用,
session.use_cookies有什么作用, @ini_set('session.use_cookies', 1);什么意思 若session.use_cookies = 1 sessionid ...
- EasyDarwin开源云平台接入海康威视EasyCamera摄像机之快照获取与上传
本文转自EasyDarwin团队成员Alex的博客:http://blog.csdn.net/cai6811376 EasyCamera开源摄像机拥有获取摄像机实时快照并上传至EasyDarwin云平 ...
- please add a 'mainClass’ property
when build an spring project with this command: mvn spring-boot:run there will may show an error mes ...
- LeetCode(83)Remove Duplicates from Sorted List
题目 Given a sorted linked list, delete all duplicates such that each element appear only once. For ex ...
- [数据挖掘课程笔记]基于规则的分类-顺序覆盖算法(sequential covering algorithm)
Rule_set = {}; //学习的规则集初试为空 for 每个类c do repeat Rule = Learn_One_Rule(D,Att-vals,c) 从D中删除被Rule覆盖的元组; ...
- 剑指Offer:反转链表【24】
剑指Offer:反转链表[24] 题目描述 输入一个链表,反转链表后,输出新链表的表头. 解题分析 这道题我才发现我是属于那种真的笨,图都画出来了流程写不出来.看了别人的代码,总觉得自己差一步. 这也 ...
- windows server 2008 + IIS 7.5实现多用户FTP(多账号对应不同目录
在windows server 2003 + IIS 6 的时候,就已经能实现多用户FTP的功能,不过设置有写繁琐,如果站点多的话,设置账号.权限这些东西都要搞很久.Windows server 20 ...
- div和span、relative和absolute、display和visibility的区别
一.div和span的区别 div是一个块级元素,可以包含段落,表格等内容,用于放置不同的内容.一般我们在网页通过div来布局定位网页中的每个区块. span是一个内联元素,没有实际意义,它的存在纯粹 ...