Problem Description

給你一個三角形的邊長,請你判斷它是銳角 (acute)、直角 (right)、或是鈍角 (obtuse) 三角形。

Input Format

輸入只有一行,含有三個由空白隔開的正整數 a, b, c (0 < a, b, c ≤ 46340),代表三角形的邊長。

Output Format


依三角形的類別輸出「acute triangle」、「right triangle」、或「obtuse triangle」。

Sample Input

3     4     5

Sample Output

right triangle


-----*Problem from【ZeroJudge, An Online Judge System For Beginners

 

My Answer

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
#include<iostream>
using namespace std;
int main(void)
{
   int a, b, c;
   while(cin>>a>>b>>c){
      a*=a, b*=b, c*=c;
      if(a+b==c||a+c==b||c+b==a)cout<<"right triangle"<<endl;
      else if(a+b>c||a+c>b||c+b>a)cout<<"acute triangle"<<endl;
      else cout<<"obtuse triangle"<<endl;
   }
   return 0;
}


 


arrow
arrow
    全站熱搜

    兔老大 發表在 痞客邦 留言(0) 人氣()