POJ 1905 Expanding Rods G++

xiaoxiao2021-02-28  107

#include <iostream> #include <cmath> #include <iomanip> using namespace std; //抄博友程序 读博友好分析 没掌握 int main() { while(1) { double l; double n; double c; cin>>l>>n>>c; if(l<0 && n<0 && c<0) { break; } double s=(1+n*c)*l; double left=0; double right=l/2.0; //double jg; double mid;//抄博友 背 while((right-left)>(1e-5))//抄博友程序 { mid=(left+right)/2; double r=(4.0*mid*mid+l*l)/(8.0*mid); //cout<<mid<<" "<<r<<" "<<2*r*asin(l/(2*r))<<endl; if(s>2*r*asin(l/(2*r))) { left=mid; //jg=mid; }else { right=mid; } } cout<<fixed<<setprecision(3)<<mid<<endl; } return 0; } 
转载请注明原文地址: https://www.6miu.com/read-32043.html

最新回复(0)