现在的位置: 首页 > 综合 > 正文

hdu 2393

2013年06月25日 ⁄ 综合 ⁄ 共 419字 ⁄ 字号 评论关闭
//   http://acm.hdu.edu.cn/showproblem.php?pid=2393
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    int n,a[3],pos;
    while(scanf("%d",&n)!=EOF)
    {
        pos=0;
        while(n--)
        {
            scanf("%d%d%d",&a[0],&a[1],&a[2]);
            sort(a,a+3);
            printf("Scenario #%d:\n",++pos);
            if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])
                printf("yes\n\n");
            else
                printf("no\n\n");
        }
    }
    return 0;
}
/*
  其实就是判断是不是直角三角形了,输入三个数字,先排序,最大的为斜边
  就直接判断了
  我这里是直接利用了sort函数,其实没必要,就三个元素
*/

抱歉!评论已关闭.