标签:pre 图形 color algo col .net include nbsp https
题意:
一根两端固定在两面墙上的杆 受热弯曲后变弯曲
求前后两个状态的杆的中点位置的距离
分析:见博客
代码:
#include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<iomanip> using namespace std; //const double esp=1e-5; int main() { double L,n,c,s,r,h; while(~scanf("%lf %lf %lf",&L,&n,&c)) { if(L<0&&n<0&&c<0) break; // s=L*(1+n*c); double low=0.0; double high=L*0.5; double mid;// printf("%lf\n",s); while(high-low>0.00001) { mid=(high+low)/2; r=(4*mid*mid+L*L)/(8*mid); if(2*r*asin(L/(2*r))<s) low=mid; else high=mid; } h=mid; cout<<fixed<<setprecision(3)<<h<<endl; //printf("%.3f\n",mid); } }
标签:pre 图形 color algo col .net include nbsp https
原文地址:https://www.cnblogs.com/linhaitai/p/9800484.html