2018 CCPC 女生赛 hdoj6288 缺失的数据范围
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6288
Summarize:
1、二分查找答案;
2、自带log函数精度不够,需自己写;
3、注意二分递归的左右区间;
4、计算中可能爆LL,故需尽可能做一步就判断一次;
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define LL long long LL T, a, b, k;
LL R = 1e18; LL log2(LL n)
{
for(int i=; i<=; i++)
if((LL)pow(2LL, i) >= n)
return i;
} bool judge(LL n)
{
LL x = n;
for(int i=; i<a; i++) {
if(x > k/n) return false;
x *= n;
} LL t = log2(n);
LL y = t;
for(int i=; i<b; i++) {
if(y>k || x>k/y) return false;
y *= t;
}
// cout<<"x,y: "<<x<<' '<<y<<endl; if(x > k/y)
return false;
return true;
} void half_find(LL l, LL r)
{
if(l == r) {
printf("%lld\n", l);
return;
}
LL mid = (l+r)/+1LL;
// cout<<"AA "<<l<<' '<<r<<' '<<mid<<endl;
if(judge(mid))
half_find(mid, r);
else
half_find(l, mid-);
} int main()
{
ios::sync_with_stdio(false);
scanf("%lld", &T);
while(T--)
{
scanf("%lld%lld%lld", &a, &b, &k);
half_find(, R);
} return ;
}
2018 CCPC 女生赛 hdoj6288 缺失的数据范围的更多相关文章
- 2018 CCPC 女生赛 hdoj6287 口算训练
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6287 Summarize: 1.分解质因数: 2.二分查找函数lower_bound与upper_bo ...
- 2018 CCPC网络赛
2018 CCPC网络赛 Buy and Resell 题目描述:有一种物品,在\(n\)个地点的价格为\(a_i\),现在一次经过这\(n\)个地点,在每个地点可以买一个这样的物品,也可以卖出一个物 ...
- 2019.ccpc女生赛-wfinal总结
2019ccpc女生赛离它结束有四天了,在这个期间我想了很多,想了想还是决定写这个总结.作为这个队伍唯一的一名大一队员,我很庆幸,能跟着两个学姐一起打比赛,计爱玲师姐,即将工作,张莹俐学姐.这估计都是 ...
- 【2018 CCPC网络赛 1004】Find Integer(勾股数+费马大定理)
Problem Description people in USSS love math very much, and there is a famous math problem . give yo ...
- 2018 CCPC 女生专场
可能是史上最弱的验题人—— Problem A (小)模拟. #include <bits/stdc++.h> using namespace std; int T; int main() ...
- 【2018 CCPC网络赛】1009 - 树
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6446 题目给出的数据为一棵树,dfs扫描每条边,假设去掉某条边,则左边 x 个点,右边 n-x 个点, ...
- 【2018 CCPC网络赛】1004 - 费马大定理&数学
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6441 Knowledge Point: 1. 费马大定理:当整数n >2时,关于x, y, z的 ...
- 2021 CCPC女生赛
newbie,A了五题铜牌收工 比赛时和队友悠哉游哉做题,想着干饭,最后幸好没滚出铜尾. 贴一下比赛过的代码 A题 签到 队友A的,判断正反方向序列是否符合要求 /*** * @Author: _Kr ...
- 2018 CCPC网络赛 几道数学题
1002 Congruence equation 题目链接 : http://acm.hdu.edu.cn/showproblem.php?pid=6439 题解 : https://www.zyb ...
随机推荐
- 详细讲解:零知识证明 之 ZCash 完整的匿名交易流程
作者:林冠宏 / 指尖下的幽灵 博客:http://www.cnblogs.com/linguanh/ 掘金:https://juejin.im/user/587f0dfe128fe100570ce2 ...
- on a null object reference 问题的解决办法
FATAL EXCEPTION: …… java.lang.RuntimeException: Unable to start activity ComponentInfo…… ava.lang.Nu ...
- 875. Koko Eating Bananas
Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The g ...
- P5165 xtq的棋盘
传送门 设\(f[i]\)为\(i\)位置向左走一步的期望时间,那么答案就是\(\sum_{i=1}^mf[i]\) 首先\(f[n]=1\),设\(p\)为向左的概率,对于\(i<n\)的位置 ...
- PJzhang:centos7上LNMP方式安装dvwa漏洞测试环境
猫宁!!! 参考链接:https://www.jianshu.com/p/5491ce5bfbac https://www.cnblogs.com/wujuntian/p/8183952.html h ...
- Luogu P2170选学霸【并查集+背包】By cellur925
题目传送门 开始看到本题完全认为就是个彻头彻尾的并查集,只要把实力相当的人都并到一个集合中,最后再找一共有多少联通块即可. 后来发现这是大错特错的qwq.因为选了一个集合中的某人,那这个集合中所有人就 ...
- PowerDesigner 16.5的下载安装破解注册(图文详解)
http://blog.csdn.net/chenchunlin526/article/details/54707757
- POJ 2104 K-th Number && 洛谷 P3834 【模板】可持久化线段树 1(主席树)
我惊奇的发现这两道题一模一样 题目背景 这是个非常经典的主席树入门题——静态区间第K小 数据已经过加强,请使用主席树.同时请注意常数优化 题目描述 如题,给定N个整数构成的序列,将对于指定的闭区间查询 ...
- hdu1233 还是畅通工程 基础最小生成树
//克鲁斯卡尔 #include<iostream> #include<algorithm> using namespace std; ; struct node { int ...
- hdu1856 More is better 基础并查集
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> ...