poj2006

化学计算题,解一元二次方程。

//zoj2351
#include <iostream>
#include <cmath>
using namespace std;

int        N,m,n;
double    k,a;

bool init()
{
    cin>>k>>a>>m>>n;
    if (k==0&&a==0&&m==0&&n==0)
        return false;
    return true;
}

void work()
{
    double    i;
    i=-log10((sqrt(k*k+4*a*m*n*k)-k)/(2*n));
    printf("%.3f\n",i);
}

int main()
{
//    freopen("t.txt","r",stdin);
    N = 1;
    while (N--)
    {
        while (init())
            work();
        if (N) cout<<endl;
    }
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/rainydays/p/3134556.html