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 ...
随机推荐
- Codeforces732E Sockets
首先检测有木有和Computer匹配的Socket,如果有则将其匹配. 然后将所有没有匹配的Socket连上Adapter,再去检测有木有Computer与Socket匹配. 重复这个操作31次,所有 ...
- 五个demo案例带你学习PHP反序列化漏洞
一直想研究下php反序列化漏洞,花了几天时间做了个简单的了解..写篇文章记录下. 直白点就是围绕着serialize和unserialize两个函数. 一个用于序列化,一个用于反序列化. 我们通常把字 ...
- The local variable fruit may not have been initialized 错误
eclipse错误提示如图: 错误代码如图: 首先这错误的翻译是:局部变量"水果"尚未初始化,所以对象该如何初始化呢,我百度之后找到了答案,修改过后如下图所示. 这个错误的问题所在 ...
- bzoj1179: [Apio2009]Atm 【缩点+spfa最长路】
题目传送门 Description Siruseri 城中的道路都是单向的.不同的道路由路口连接.按照法律的规定, 在每个路口都设立了一个 Siruser i 银行的 ATM 取款机.令人奇怪的是,S ...
- Access 中case when then else end不支持使用switch代替
Access 中case when then else end不支持使用switch代替 这里主要是实现一个表中多个字段,多个字段之间作比较然后取得最大值或者最小值用来处理 case when the ...
- 状态压缩DP SRM 667 Div1 OrderOfOperations 250
Problem Statement Cat Noku has just finished writing his first computer program. Noku's compute ...
- 491 Increasing Subsequences 递增子序列
给定一个整型数组, 你的任务是找到所有该数组的递增子序列,递增子序列的长度至少是2.示例:输入: [4, 6, 7, 7]输出: [[4, 6], [4, 7], [4, 6, 7], [4, 6, ...
- HDU 5808 Price List Strike Back bitset优化的背包。。水过去了
http://acm.hdu.edu.cn/showproblem.php?pid=5808 用bitset<120>dp,表示dp[0] = true,表示0出现过,dp[100] = ...
- 为localhost添加https
1.按照https://stackoverflow.com/a/7184031/4619958来做 其中,CommonName填写localhost 2.在ssl.conf里头加上 <Direc ...
- Split方法,拆分字符串后,去除返回的空值
我们在使用Split('')方法的时候,根据指定的 '字符' 对字符串进行拆分,当'字符’为最后一个,将会拆分一个空值进行返回. 这个时候我们可以使用 string.Split(new ch ...