CF689C Mike and Chocolate Thieves(二分答案+数学)
来源:互联网 发布:google 人工智能 开源 编辑:程序博客网 时间:2024/04/30 03:28
二分答案,发现最大数一定是
#include <bits/stdc++.h>using namespace std;#define ll long longll n;ll calc(ll x){ ll res=0; for(ll i=2;i;++i){ ll t=i*i*i;if(t>x) break; res+=x/t; }return res;}int main(){ scanf("%lld",&n); ll l=1,r=1LL<<55; while(l<=r){ ll mid=(l+r)/2; if(calc(mid)>=n) r=mid-1; else l=mid+1; }if(calc(r+1)!=n) puts("-1"); else printf("%lld\n",r+1); return 0;}
阅读全文
0 0
- CF689C Mike and Chocolate Thieves(二分答案+数学)
- codeforces_689C. Mike and Chocolate Thieves(二分)
- Codeforces #361C. Mike and Chocolate Thieves 二分 数学
- Codeforces 689.C Mike and Chocolate Thieves 二分+数学
- Codeforces #361 D Mike and Chocolate Thieves(二分+数学)
- Codeforces 678C Mike and Chocolate Thieves(二分)
- Codeforces 689C. Mike and Chocolate Thieves(二分)
- Mike and Chocolate Thieves
- Codeforces 689C Mike and Chocolate Thieves (二分)
- cf#361-C - Mike and Chocolate Thieves-二分
- Codeforces 689C Mike and Chocolate Thieves【二分+思维】
- 【打CF,学算法——三星级】CodeForces 689C Mike and Chocolate Thieves (二分)
- Codeforces Round #361 (Div. 2) C. Mike and Chocolate Thieves(二分判断)
- Codeforces 689C-Mike and Chocolate Thieves(求下界的二分查找)
- CodeForces-689C.Mike and Chocolate Thieves
- CodeForces 689C Mike and Chocolate Thieves
- Codeforces-689C-Mike and Chocolate Thieves
- Codeforces Round #361 (Div. 2) C. Mike and Chocolate Thieves 二分
- vue工程 简单总结
- Git使用教程
- Coolfire黑客入门系列
- Python机器学习之XGBoost从入门到实战(基本理论说明)
- ERROR(ORCAP-36052): Value for property PCB Footprint contains carriage return for
- CF689C Mike and Chocolate Thieves(二分答案+数学)
- tcp/ip学习笔记--第11章 UDP(user data protocol)
- 20171113
- python的赋值与深浅拷贝
- 2017年11月19日训练笔记
- 【转载】cvc-complex-type.2.4.a: Invalid content was found starting with element
- Linux网络编程基础(一)
- 第九届山东理工大学ACM网络编程擂台赛 正式赛 sdut4075GCD
- Java面向对象学习笔记