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.
|
Input The first line contains an integer t means the number of test cases.
|
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;
}