E
来源:互联网 发布:linux多线程编程 编辑:程序博客网 时间:2024/06/09 18:58
Uva https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4966
Vjudge https://vjudge.net/problem/UVALive-6954
看不t 23333333333
上下界0 - 100 大神说随缘。。。
码着三分吧
注意精度 esp 其实最后输出7位就可以了
#include <algorithm>#include <iostream>#include <cstring>#include <iomanip>#include <cstdlib>#include <string>#include <cstdio>#include <cmath>#include <queue>#include <stack>#include <ctime>#include <map>using namespace std;#define sf scanf#define pf printf#define ll long long#define For(i,a,b) for(i=a;i<=b;i++)#define _For(i,a,b) for(i=b;i>=a;i--)#define Out(x) cout<<x<<endl#define Outdouble(x,a) cout<<fixed<<setprecision(a)<<1.0*x<<endl#define _Outdouble(x,a) cout<<fixed<<setprecision(a)<<1.0*x#define mset(arr,num) memset(arr,num,sizeof(arr))#define ok std::ios::sync_with_stdio(0)#pragma comment(linker, "/STACK:102400000,102400000")#pragma GCC optimize("O3")const ll inf = 1e12+10; ///const double esp = 1e-7; ///const int NUM = 1e5+10;// #define debug#if defined (debug)---check---#endif/// ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //////三分用来求单峰函数的极(最)值 ///二分是求单调函数的最值double two = sqrt(2);double p,s,v;int n;double cal(double x){return s*(1+1/x)/v + n*pow(log2(n),x*two)/p/1e9;}int main(){double l,r; double mid,midmid; while(cin>>n>>p>>s>>v) { l = 0,r = 100; /// while(r - l > esp) { mid = (l+r)/2.0; midmid = (mid + r)/2.0; if(cal(mid) < cal(midmid)) ///求极小值 极大值下面边界相反 { r = midmid; } else { l = mid; } } _Outdouble(cal(l),14); cout<<" "; Outdouble(l,14); } return 0;}
1 0
- e
- E
- E
- e
- e
- e
- e
- e
- E
- e
- E
- e
- e
- E
- e
- e
- e
- E
- 输入文件名及路径创建该文件,并把从键盘输入的内容保存到该文件,最后将该文件的路径、该文件名及文件中的内容输出到屏幕。
- MapReduce:详解Shuffle过程
- 《C++primer》阅读笔记<二>
- C#并发编程(二)-动态并行和并行聚合
- hdu5113 Black And White DFS+剪枝
- E
- 轻量却超强——推荐几款好用的截图工具
- Mybatis批量执行语句
- 算法训练 字串统计 (暴力)
- [NOIP] [模拟] NOIP2016Day1 玩具谜题
- ModelAndView详解
- SQL 语句积累
- 正则表达式(三)-- 重复匹配
- JQuery实现表单验证(注册页面)