这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2393
判断是否是直角三角形。
水题~~~
AC代码:
#include
#include
#include
using namespace std;
int nCases;
bool isUpright(int x, int y, int z)
{
if(x*x + y*y == z*z)
return 1;
return 0;
}
int main()
{
cin >> nCases;
int a, b, c;
for(int i=1; i<=nCases; ++i)
{
cin >> a >> b >> c;
cout << "Scenario #" << i << ":\n";
if(isUpright(a, b, c) || isUpright(b, c, a) || isUpright(a, c, b))
cout << "yes\n\n";
else
cout << "no\n\n";
}
}