“今日头条杯”首届湖北省大学程序设计竞赛(网络同步赛)A. Srdce and Triangle

题目描述 


Let   be a regualr triangle, and D is a point in the triangle. Given the angle of  . Then let AD, CD and BD form a new triangle, what is the size of the three angles?

输入描述:

 
  

Input contains multiple cases, please process to the end of input.

For each line in the input, contains three integers, $\alpha, \beta, \gamma$, which are the size of the angel , and in degree.

输出描述:

For each line of input, output one line with three numbers in ascending order, the three angles in the new triangle, your answer will be considered as correct if and only if the relative or absolute error is less than , If the new triangle cannot be formed, output -1 -1 -1 instead. 
示例1

输入

120 120 120

输出

60.0000 60.0000 60.0000

思路:

      

过点 P 分别作三边的平行线,将整个三角形划分为三个蓝色四边形。那么,图中的三个蓝色四边形都有一组对边平行,因而它们都是梯形;事实上,容易看出,这些梯形的两个底角都是 60 度,因而它们都是等腰梯形。只需注意到,等腰梯形的两条对角线长度是相等的,因此红色三角形 A’B’C’ 的三边长度事实上就分别等于 PA 、 PB 、 PC 。可以发现正三角形内的任意一点,连接三个顶点后都可以组成一个三角形,然后标注各个角,利用等腰三角形的性质寻找关系。

ACDAIMA:

# include <iostream>
#include <algorithm>
# include <math.h>
using namespace std;
int main()
{
    double a,b,c,s[3];
   while(~scanf("%lf%lf%lf",&s[0],&s[1],&s[2]))
   {
   	    sort(s, s+3);
	    s[0] -= 60;
	    s[1] -= 60;
	    s[2] -= 60;
	    printf("%.4f %.4f %.4f\n",s[0],s[1],s[2]);
   }
    
   return 0;
}




猜你喜欢

转载自blog.csdn.net/sugarbliss/article/details/80045766
今日推荐