C
来源:互联网 发布:药品查询软件下载 编辑:程序博客网 时间:2024/06/13 17:11
这题我用三分来做。
#include<iostream>#include<string.h>#include<string>#include<stack>#include<queue>#include<functional>#include<set>#include<map>#include<stdlib.h>#include<vector>#include<math.h>#include <algorithm>#pragma warning(disable:4996)using namespace std;double EPS = 1e-6;double find(double x,double y){return 6 * pow(x, 7) + 8 * pow(x, 6) + 7 * pow(x, 3) + 5 * pow(x, 2) - y*x;}double sf(double y){double lo=0, r=100,mid,mmid;while(r-lo>EPS){mid = (r + lo)/2;mmid = (mid + r)/2;if (find(mid,y) < find(mmid,y))r = mmid;elselo = mid;}return lo;}int main(){int t;scanf("%d", &t);while (t--){double y;scanf("%lf", &y);double d = sf(y);printf("%.4lf\n", find(d,y));}return 0;}
阅读全文
0 0
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- C
- c
- C
- Spring AOP Schema aop:config、tx:advice
- C++:STL标准入门汇总
- Java反射机制
- SpringBoot和Hibernate整合
- ZooKeeper的学习
- C
- 数据库连接池示例以及性能分析
- C# WinForm 判断本机是否联网
- python安装numpy和pandas
- 前端静态资源版本更新与缓存之——通过gulp 在原html文件上自动化添加js、css版本号
- C++ 多态 (纯)虚函数 虚函数表解析
- 雪花
- servlet 参考
- Android Studio生成自定义jar包(同时将assets目录打入jar包)