hdu_1.2.7_Just A Triangle

                              Just A Triangle

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 1386 Accepted Submission(s): 910


 

Problem Description

This is an easy problem, just for you to warm up.
Give you three edges of a triangle. Can you tell me which kind of triangle it stands for?
If it’s a right triangle(直角三角形), please output “good”. If it’s a isosceles triangle(等腰三角形), please output “perfect”. Otherwise, please output “just a triangle”. You may suppose the input is legal.

 


 

Input

The first line contains an integer t means the number of test cases.
The each case contains three integers a, b, c in a line which stands for the length of the three edges.
(0 <a, b, c < 300).

 


 

Output

For each case, output the answer in one line.

 


 

Sample Input

43 4 52 2 3 1 4 44 6 3

 


 

Sample Output

goodperfectperfectjust a triangle

 


 

 

Source

HDU 2009-11 Programming Contest

 


 

Recommend

lcy

 

#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<stdio.h>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;//头文件
int triangle(int a,int b,int c)
{
	if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a)
	return 1;
	if(a==b||a==c||b==c)
	return 2;
	else
	return 3;
}
int main()
{
	int n;
	int a,b,c;
	int flag;
	cin>>n;	
	for(int i=0;i<n;i++)
	{
		cin>>a>>b>>c;
		flag=triangle(a,b,c);
		if(flag==1)
		cout<<"good"<<endl;
		if(flag==2)
		cout<<"perfect"<<endl;
		if(flag==3)
		cout<<"just a triangle"<<endl;		
	}
	return 0;
}
 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值