poj 1905Expanding Rods

简介:
/*
  二分 + 几何
  弧长L, 圆半径R, 弧度 q, L=R*q;
  二分: 弧度(0~PI) 或者 高度(L/2~L) 
*/
#include<cstdio> 
#include<iostream>
#include<cmath>
using namespace std;
const double PI = acos(-1.0);
double L, L1, T, C, R, Q;

int main(){
   
   while(scanf("%lf%lf%lf", &L, &T, &C) && (L!=-1 || T!=-1 || C!=-1)){
      L1 = (1+T*C)*L;
      double ld=0.0, rd=PI, tmp;
      Q = (ld+rd)/2; 
      R = L/2/sin(Q);
      while(fabs(tmp = R*2*Q-L1)>1e-8){
         if(tmp>0) rd=Q;
         else ld=Q;
         Q=(ld+rd)/2;
         R = L/2/sin(Q);
      }
      printf("%.3lf\n", R-sqrt(R*R - (L/2)*(L/2)));
   } 
   return 0;
}









本文转自 小眼儿 博客园博客,原文链接:http://www.cnblogs.com/hujunzheng/p/3876698.html,如需转载请自行联系原作者
目录
相关文章
|
2月前
|
算法 数据建模
Poj 3169(差分约束系统)
Poj 3169(差分约束系统)
24 0
POJ 1936 All in All
POJ 1936 All in All
66 0
poj-2551-ones
Description Given any integer 0
756 0
|
机器学习/深度学习
|
人工智能
POJ 1936 All in All
Description You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way.
770 0
poj 2912 Rochambeau
点击打开链接poj 2912 思路: 带权并查集 分析: 1 有n个小孩玩游戏,里面有一个入是裁判,剩下的人分为三组。现在我们既不知道裁判是谁也不知道分组的情况。
936 0
poj 2528 Mayor's posters
点击打开链接poj2528 思路:离散化+线段树成段更新 分析: 1 首先这一题的数据是错误的,这题的区间的最大值为10000000,如果我们按照正常的线段树的思路去做的话肯定是会超内存和超时的。
1070 0