ACM setp

Just A Triangle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2273    Accepted Submission(s): 1503
 

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

4
3 4 5
2 2 3
1 4 4
4 6 3

Sample Output

good
perfect
perfect
just a triangle
 

Source

HDU 2009-11 Programming Contest

不用考虑不能构成三角形的情况,所以连判断是不是三角形的条件都不用加。所以简单了。下面上代码。

#include <stdio.h>
#include <string.h>
int main()
{
	int n,i;
	scanf("%d",&n);
	while(n--)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		if(a*a==b*b+c*c ||b*b==a*a+c*c || c*c==a*a+b*b)
			printf("good\n");
		else if(a==b ||b==c ||a==c )
			printf("perfect\n");
		else
			printf("just a triangle\n");

	}
	return 0;
}

时间: 2024-08-05 03:43:36

ACM setp的相关文章

《ACM/ICPC 算法训练教程》读书笔记一之数据结构(堆)

书籍简评:<ACM/ICPC 算法训练教程>这本书是余立功主编的,代码来自南京理工大学ACM集训队代码库,所以小编看过之后发现确实很实用,适合集训的时候刷题啊~~,当时是听了集训队final的意见买的,感觉还是不错滴. 相对于其他ACM书籍来说,当然如书名所言,这是一本算法训练书,有着大量的算法实战题目和代码,尽管小编还是发现了些许错误= =,有部分注释的语序习惯也有点不太合我的胃口.实战题目较多是比较水的题,但也正因此才能帮助不少新手入门,个人认为还是一本不错的算法书,当然自学还是需要下不少

acm常见算法及例题

转自:http://blog.csdn.net/hengjie2009/article/details/7540135 acm常见算法及例题 初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法

推荐acm题目

杭电  http://acm.hdu.edu.cn/onlineuser.php. 浙大  http://acm.zju.edu.cn/onlinejudge/submit.do?problemId=1http://poj.org/status惟一的阿福 password:14420121 263273 14420121 学校原来网站      http://10.1.5.253:8080/acmhome/welcome.do?method=index

ACM比赛经验

ACM比赛经验: 推荐此篇文章打印,与模板放在一起. 1. 比赛中评测会有些慢,偶尔还会碰到隔10分钟以上才返回结果的情况,这段时间不能等结果,必须开工其他题,如果WA,两道题同时做.交完每道题都要先打印. 2. 比赛时发的饭不是让你当时就吃的,那是给你赛后吃的.基本上比赛中前几名的队都没人吃,除非领先很多. 3. 很多选手,尤其是第一次参加比赛的,到一个新环境,全当旅游了,参观的参观,找同学的找同学,玩玩乐乐就把正事抛到脑后了,结果比赛自然没什么好成绩,这样的例子太多了.所以到参赛地后要时刻不

HDU 3296 &amp; POJ 3138 Acm Team Section(数学)

题目链接: HDU: http://acm.hdu.edu.cn/showproblem.php?pid=3296 POJ:  http://poj.org/problem?id=3138 Acm Team Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 159    Accepted Submission(s): 47

2014 ACM/ICPC Asia Regional Guangzhou Online Wang Xifeng&#39;s Little Plot HDU5024

一道好枚举+模拟题目.转换思维视角 这道题是我做的,规模不大N<=100,以为正常DFS搜索,于是傻乎乎的写了起来.各种条件限制模拟过程 但仔细一分析发现对每个点进行全部八个方向的遍历100X100X100^8 .100X100个点,每个点在走的时候8中选择,TLE 于是改为另一个角度: 以符合要求的点为拐弯点,朝两个垂直的方向走,求出最远的距离.这样只要对每个点各个方向的长度知道,组合一下对应的就OK. 避免了每个点深搜. PS:搜索的时候x,y写反了,导致构图出现问题,以后用[dy][dx]

HDU 5014 Number Sequence(2014 ACM/ICPC Asia Regional Xi&#39;an Online) 题解

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014 Number Sequence Problem Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● ai ∈ [0,n] ● ai ≠ aj( i ≠ j ) For sequence a and sequ

[ACM] hdu 1242 Rescue (BFS+优先队列)

Rescue Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel's friends want to save Angel. Their task is:

ACM退役记&amp;&amp;回忆录

ACM退役记 2017.9.19星期二,"九一八事变"八十六年后的第二天,永远记住这个日子,刚好是我报名ACM到现在,刚好满一年,而今天正是我注册杭州电子科技大学OJ的时间(就是这一天报名的),附上小图一张! 嗯,我退役了,真的退役了,从此告别了ACM的生涯,虽然有很多遗憾,虽然有很多不舍,虽然有很多很多不情愿,但是,,,还是没能阻止这一天的到来,可能你们会认为我退役的有点早,可能你们也会有很多疑惑,为啥这么优秀这么强的大佬竟然退役的这么早...(自嘲一下,其实菜的一逼) 其实这个原因