文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>1125.越野车大赛

1125.越野车大赛

时间:2010-11-12  来源:gzzcracker

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#define pi 3.1415926535898
using namespace std;

int main(int argc, char* argv[]) {
    int n, m;
    int s1, s2, s3;

    double sina, cosa, tana;
    double sinb, cosb, tanb;
    double sinc, cosc, tanc;
    double mina, maxa, mida, sumx;

    scanf("%d %d", &n, &m);
    scanf("%d %d %d", &s1, &s2, &s3);

    mina = 0;
    maxa = pi / 2;
    while (true) {
        mida = (mina + maxa) / 2;

        sina = sin(mida);
        cosa = cos(mida);
        tana = sina / cosa;

        sinb = sina * s2 / s1;
        cosb = sqrt(1 - sinb * sinb);
        tanb = sinb / cosb;

        sinc = sinb * s3 / s2;
        cosc = sqrt(1 - sinc * sinc);
        tanc = sinc / cosc;

        sumx = m * (tana + tanb + tanc);
        if (abs(sumx - n) <= 0.000001) {
            printf("%.10f\n", m / cosa / s1 + m / cosb / s2 + m / cosc / s3);
            break;
        }
        if (sumx < n)
            mina = mida;
        else
            maxa = mida;
    }

    return 0;
}


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载