"Today's Toutiao Cup" The First Hubei University Programming Contest (Network Synchronized Contest)--A. Srdce and Triangle

As shown in the figure below, this is the first question of the "Today's Toutiao Cup" first Hubei University programming competition, as a supplementary question after the competition

 

Topic description: link here

The github address of this set of questions (which contains data, question solutions, and on-site rankings): click here

 

 


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?

Enter description:

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.

Output description:

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. 

 

Problem analysis: It is an equilateral triangle, and then there is a point D in the equilateral triangle, known   and   , find the interior angle of the triangle formed by AD, BD, and CD as sides.

 

There are three equations listed:

But it was very uncomfortable. After 3 hours of solving the equation, I couldn't figure it out (maybe my math is too weak). Later, I wanted to bisect and bisect the angle DAB, but the scene was wa, so I went back and made it up.

 

Now let's talk about a very simple method:

 

Is this an algebra problem? It's a solution problem. Let's rotate the triangle ABC 60 degrees counterclockwise, as shown below:

There will be a triangle PP'C with abc as the side. Since ΔAPP' is an equilateral triangle, the three angles can be calculated as   and   minus 60 degrees. This is a water problem. (ORZ, stuck for 4 hours)

 

/*
    data:2018.04.22
    author:gsw
    link:https://www.nowcoder.com/acm/contest/104#question
    tip: Wuhan University Competition--Supplementary Questions
*/
#define IO ios::sync_with_stdio(false);
#define ll long long

#include<iostream>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<vector>
#include<algorithm>

using namespace std;

intmain ()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        int ans[ 3 ];
        years[ 0 ]=y - 60 ;
        years[ 1 ]=b - 60 ;
        years[ 2 ]=c - 60 ;
        sort(years,years + 3 );
        printf( " %d %d %d\n " ,years[ 0 ],years[ 1 ],years[ 2 ]);
    }
}

 

 

 

 

The following will be a two-point approach: to be supplemented. . . .

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324769001&siteId=291194637