您的位置:首页 > 其它

nyoj-659-判断三角形

2013-07-13 11:56 169 查看
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
int n,a[3],i,j;
while(scanf("%d",&n)!=EOF)
{
for(i=1;i<=n;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[j]);
sort(a,a+3);
int num=0;
if(a[0]+a[1]>a[2])
{
num++;
if(a[0]==a[1]||a[0]==a[2]||a[1]==a[2])
{
num++;
if(a[0]==a[1]&&a[1]==a[2])
num++;
}
}
switch (num)
{
case 0: printf("Case #%d:\nNO\n",i); break;
case 1: printf("Case #%d:\nYE\n",i); break;
case 2: printf("Case #%d:\nYE YE\n",i); break;
case 3: printf("Case #%d:\nYE YE YE\n",i); break;
}
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: