POJ1905 expanding rods 【水二分+谜之WA】
来源:互联网 发布:随身wifi发射器软件 编辑:程序博客网 时间:2024/04/28 00:32
一道很水的题,就是不知道为什么wa,,,
其实小优那个精度控制循环控制二分的方法不算好,如果esp太小,会TLE,直接人工控制次数最好了
#include <cstdio>#include <cmath>#include <iostream>using namespace std;double getres(double r,double s,double l){ //cout<<(r-s/acos(1-l*l/(2.0*r*r)))<<endl; //cout<<r<<' '<<s<<' '<<l<<endl<<endl; if((r-s/acos(1-l*l/(2.0*r*r)))>0) return true; else return false;}int main(){ #ifndef ONLINE_JUDGE//freopen("G:/1.txt","r",stdin);//freopen("G:/2.txt","w",stdout);#endif//cout<<getres(1,pi/2,1.414);double len,tm,co;while(cin>>len>>tm>>co) { if(len==-1&&tm==-1&&co==-1) break; double S=(1+tm*co)*len; int times=100; double l=len/2,r=1<<30,mid=(l+r)/2; while(times--) { if(getres(mid,S,len)) l=mid; else r=mid; mid=(l+r)/2; } double res=mid-sqrt(mid*mid-len*len/4); //printf("%.3f\n",mid); printf("%.3f\n",res); } return 0;}
0 0
- POJ1905 expanding rods 【水二分+谜之WA】
- POJ1905 Expanding Rods 二分
- poj1905 Expanding Rods 二分
- 二分 poj1905 Expanding Rods
- Expanding Rods(二分POJ1905)
- POJ1905 Expanding Rods(二分)
- poj1905 Expanding Rods(二分+几何)
- 【POJ1905】Expanding Rods 二分答案+推公式
- 【poj1905】Expanding Rods——二分
- POJ1905:Expanding Rods
- POJ1905 Expanding Rods
- POJ1905--Expanding Rods
- POJ1905 Expanding Rods
- poj1905 Expanding Rods
- POJ1905 Expanding Rods
- POJ1905-Expanding Rods - 二分法。
- POJ1905-----Expanding Rods
- Expanding Rods<poj1905>
- 黑马程序员---Java中的映射Map
- myeclipse中类和方法添加注释
- Struts2的表单UI标签(2)
- 如何在windows下是用mysqldumpslow命令
- apt-get 和 yum
- POJ1905 expanding rods 【水二分+谜之WA】
- [LeetCode126] Valid Palindrome
- MMU、Cache、TLB 的作用
- 守护进程
- 超强vim配置文件
- OpenCV-2.4.6-android-sdk 人脸识别demo搭建
- C++中输入函数详解
- Hive SQL的编译解析过程
- proxool详细配置说明