poj-1905 Expanding Rods (二分)
来源:互联网 发布:甘肃教师网络研修社区 编辑:程序博客网 时间:2024/05/16 02:08
题意:一个板子加在两个墙之间,如果加热它,那么它就会向上弯曲,并且给出弯曲后长度的变化公式 L'=(1+n*C)*L。求变化后板子的最高处离原位置多高。
思路:普通几何题,各种做辅助线,之后设升高度为h通过h,l,r三者勾股定理得到一个等式。之后我们需要意识到的是c++里有三角函数,我们可以通过l,r求出扇形区域圆心角角度,用arcsin转化为弧度后可建立高度h与弯曲长度L’的关系。之后二分枚举高度。
#include <iostream>#include <algorithm>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>#include <queue>#define INF 0x3f3f3f3f#define mod 100000000using namespace std;double esp=1e-5;int main(){ double l,n,c; while(scanf("%lf%lf%lf",&l,&n,&c)!=EOF) { if(l<0&&n<0&&c<0){ break; } double h=0; double l2; l2=(1+n*c)*l; double low=0,high=l*0.5,mid; while(high-low>esp) { mid=(low+high)*0.5; double r=(4*mid*mid+l*l)/(8*mid); if(2*r*asin(l/(2.0*r))<l2) low=mid; else high=mid; } printf("%.3f\n",mid); } return 0;}
0 0
- poj-1905 Expanding Rods (二分)
- POJ 1905 Expanding Rods(二分)
- POJ 1905 Expanding Rods(二分)
- POJ 1905Expanding Rods(计算二分)
- POJ 1905 Expanding Rods (二分)
- POJ - 1905 Expanding Rods (数学+二分)
- poj 1905 Expanding Rods(二分)
- POJ 1905 Expanding Rods(二分)
- POJ 1905 Expanding Rods(二分)
- POJ 1905 Expanding Rods(二分搜索)
- POJ 1905 Expanding Rods(二分)
- poj--1905 Expanding Rods(二分)
- 【POJ 1905】 Expanding Rods (二分)
- POJ 1905 Expanding Rods二分
- poj 1905 Expanding Rods(二分)
- POJ Expanding Rods 1905 (二分)
- POJ 1905 Expanding Rods 解题报告(二分)
- POJ 题目1905 Expanding Rods(二分,数学几何)
- keil烧写错误整理
- android事件传递
- asp.net 链接数据库时 尝试加载 Oracle 客户端库时引发 BadImageFormatException。
- 【转】Tmux - Linux从业者必备利器
- Node.js内存泄漏分析
- poj-1905 Expanding Rods (二分)
- uva11078【RMQ】
- PageSetupDialog 控件页边距bug的完整解决
- iOS开发调试技巧总结
- JNI开发的常见错误&&Android.mk文件说明&& jni开发的简便流程
- Ajax原理学习
- 片上网络
- 数据结构算法之排序系列Java、C源码实现(7)--归并排序
- 优先级队列:PriorityQueue