标签:
给你一个三角形,已知一条边上的高
首先我们脑补可得,有解的情况只可能是(a=b && b=c) || (c>b && b>a)否则就输出”
然后重点就是怎么求ans,首先根据答案的任意性,我们显然可以令定点为
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#define sqr(a) ((a)*(a))
using namespace std;
double a,b,c;
int main()
{
freopen("sgu244.in","r",stdin);
freopen("sgu244.out","w",stdout);
int aa,bb,cc;
scanf("%d%d%d",&aa,&bb,&cc);
a=aa,b=bb,c=cc;
double t=sqrt(sqr(c)-sqr(a))-sqrt(sqr(b)-sqr(a));
double g=sqrt(sqr(c)-sqr(a));
if(aa==bb && bb==cc)
{
puts("YES");
printf("0 0\n");
printf("1 %d\n-1 %d\n",-aa,-aa);
}
else if(cc>bb && bb>aa)
{
puts("YES");
printf("0 0\n");
double x=sqrt(sqr(a)*t/(g-t)+g*t);
printf("%.20lf %.20lf\n",x+g,-a);
printf("%.20lf %.20lf\n",-x+g,-a);
}
else puts("NO");
fclose(stdin);
fclose(stdout);
return 0;
}
sgu-244 Height, Bisector and Median
标签:
原文地址:http://blog.csdn.net/qq_21995319/article/details/45749873