poj1936(公式+二分)

参考(http://blog.csdn.net/lyy289065406/article/details/6648562)

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
double l,n,c;
double eps = 1e-6;
int main()
{
    while (cin>>l>>n>>c) {
        if (l<0&&n<0&&c<0) {
            break;
        }
        double s = (1+n*c)*l;
        double ma = l/2,mi = 0;
        double mid = (ma+mi)/2;
        while (ma-mi>eps) {
            mid = (ma+mi)/2;
            double r = (4*mid*mid+l*l)/8/mid;
            if (s-2*r*asin(l/2/r)>eps) {
                mi = mid;
            }
            else
                ma = mid;
        }
        cout<3)<return 0;
}

你可能感兴趣的:(poj1936(公式+二分))