sgu244:Height, Bisector and Median(几何)

题目大意+分析均见:
http://46aae4d1e2371e4aa769798941cef698.devproxy.yunshipei.com/qq_21995319/article/details/45749873
其实就是一道解方程的题目…

AC code:

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#define pb push_back
#define mp make_pair
#define ONLINE_JUDGE
typedef long long LL;
typedef double DB;
typedef long double LD;
using namespace std;

DB sqr(DB x) {return x*x;}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int h, Bisector, Median;
    scanf("%d%d%d", &h, &Bisector, &Median);
    if(h == Bisector && Bisector == Median)
    {
        puts("YES");
        printf("0 %d\n", h);
        printf("1 0\n-1 0\n");
    }
    else if(h < Bisector && Bisector < Median)
    {
        puts("YES");
        DB a, b, x;
        a = sqrt(sqr((DB)Median)-sqr((DB)h));
        b = a-sqrt(sqr((DB)Bisector)-sqr((DB)h));
        x = sqrt(a*b+b*sqr(h)/(a-b));
        printf("0 %d\n", h);
        printf("%.20lf 0\n", x+a);
        printf("%.20lf 0\n", a-x);
    }
    else puts("NO");

    #ifndef ONLINE_JUDGE
    fclose(stdin);
    fclose(stdout);
    #endif
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值