您的位置:首页 > 其它

UVa 11479 - Is this the easiest problem?

2013-10-12 00:49 531 查看
题目:给出三角形三边判断所属集合。

分析:简单题。直接判断即可。

注意:数据可能有负数、使用long long类型。

#include <iostream>
#include <cstdlib>
#include <cstdio>

using namespace std;

int main()
{
	int t;
	long long a,b,c;
	while ( cin >> t )
		for ( int i = 1 ; i <= t ; ++ i ) {
			cin >> a >> b >> c;
			printf("Case %d: ",i);
			if ( a > 0 && a == b && b == c )
				printf("Equilateral\n");
			else if ( a > 0 && b > 0 && c > 0 ) { 
				if ( a == b && a+b > c || b == c && b+c > a || a == c && a+c > b )
					printf("Isosceles\n");
				else if ( a+b <= c || a+c <= b || b+c <= a )
					printf("Invalid\n");
				else printf("Scalene\n");
			}else printf("Invalid\n");
		}
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐