hdu 6288(二分法加精度处理问题)】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6288 题意:给出a,b,k,n可满足(n^a)*(⌈log2n⌉)^b<=k ,求最大的n值三个正整数a,b,k(1≤a,b≤10,10^6≤k≤10^18) 题目思路:这类给数学式子求n的最大值,且数据量大且多的,考虑时间复杂度,我们采用二分法找出n 思路:很明显就是二分n,向上取整可以先预处理出2^62,然后直接循环找到b的底数j,处理n^a*j^b一开始我们用的是powl,但是被卡精度了,卡了…
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4004 题目意思是青蛙要过河,现在给你河的宽度,河中石头的个数(青蛙要从石头上跳过河,这些石头都是在垂直于河岸的一条直线上) 还有青蛙能够跳跃的 最多 的次数,还有每个石头离河岸的距离,问的是青蛙一步最少要跳多少米可以过河> 这是一道二分加贪心的题,从0到的河宽度开始二分,二分出一个数然后判断在这样的最小步数(一步跳多少距离)下能否过河 判断的时候要贪心 主要难在思维上,关键是要想到二分上去,能想到…
题意:给定一个开始时间和一个角度,问你下一个时刻时针和分针形成这个角度是几点. 析:反正数量很小,就可以考虑暴力了,从第一秒开始暴力,直到那个角度即可,不会超时的,数目很少,不过要注意精度. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #inclu…
#include<stdio.h>#include<iostream>using namespace std;double f(double x){ return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;}int main(){ int t,flag; double y,i,j,mid; cin>>t; while(t--) {   i=0.0;   j=100.0;   cin>>y;   if(y<f(0.0)||y>f(…
Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12138    Accepted Submission(s): 4280 Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I…
Transportation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2301    Accepted Submission(s): 966 Problem Description There are N cities, and M directed roads connecting them. Now you want to t…
题目 #include<stdio.h> int main() { int t; double a,s; scanf("%d",&t); while(t--) { s=; ;i<;i++) { scanf("%lf",&a); s+=a; } //1.注意案例的输出格式 //2.rounded to the nearest penny int ss=s/12.0+0.005; printf("$%d",ss);…
普通的剪枝会超时,必须加入奇偶性剪枝. 直接上图: AC代码: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=10; char mp[maxn][maxn]; int d[maxn][maxn]; int n,m,T; const int dx[]={0,0,1,-1}; const int dy[]={1,-1,0,0}; int s…
题目: The trouble of Xiaoqian Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1997    Accepted Submission(s): 711 Problem Description In the country of ALPC , Xiaoqian is a very famous mathematici…
主要思想就是两端逼近,最后得到结果,0MS #include <iostream> #include <cstdlib> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; ; double deal(double n) { *pow(n,) + *pow(n,) + *pow(n,) + *n + ; } int main() { int t,…