Problem Description
You are building a house. You’d prefer if all the walls have a precise right angle relative to the ground, but you have no device to measure angles. A friend says he has a great idea how you could ensure that all walls are upright: All you need to do is step away a few feet from the wall, measure how far away you are from the wall, measure the height of the wall, and the distance from the upper edge of the wall to where you stand. You friend tells you to do these measurements for all walls, then he’ll tell you how to proceed. Sadly, just as you are done, a timber falls on your friend, and an ambulance brings him to the hospital. This is too bad, because now you have to figure out what to do with your measurements yourself.

Given the three sides of a triangle, determine if the triangle is a right triangle, i.e. if one of the triangle’s angles is 90 degrees.

 
Input
The inputs start with a line containing a single integer n. Each of the n following lines contains one test case. Each test case consists of three integers 1 <= a, b, c <= 40000 separated by a space. The three integers are the lengths of the sides of a triangle.
 
Output
The output for every scenario begins with a line containing “Scenario #i:”, where i is the number of the scenario counting from 1. After that, output a single line containing either the string “yes” or the string “no”, depending on if the triangle in this test case has a right angle. Terminate each test case with an empty line.
 
Sample Input
2
36 77 85
40 55 69
 
Sample Output
Scenario #1:
yes

Scenario #2:
no

 
Source
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath> using namespace std; int main()
{
int z,t = ;
cin>>z;
while(z--)
{
printf("Scenario #%d:\n",++t);
int a,b,c;
cin>>a>>b>>c;
if(a>b) swap(a,b);
if(b>c) swap(b,c);
if(a*a+b*b == c*c) cout<<"yes"<<endl<<endl;
else cout<<"no"<<endl<<endl;
}
return ;
}

hdu2393Higher Math的更多相关文章

  1. JavaScript中Math对象的方法介绍

    1.比较最值方法 比较最值有两种方法,max() 和 min() 方法. 1.1 max() 方法,比较一组数值中的最大值,返回最大值. var maxnum = Math.max(12,6,43,5 ...

  2. JavaScript Math和Number对象

    目录 1. Math 对象:数学对象,提供对数据的数学计算.如:获取绝对值.向上取整等.无构造函数,无法被初始化,只提供静态属性和方法. 2. Number 对象 :Js中提供数字的对象.包含整数.浮 ...

  3. Chrome V8引擎系列随笔 (1):Math.Random()函数概览

    先让大家来看一幅图,这幅图是V8引擎4.7版本和4.9版本Math.Random()函数的值的分布图,我可以这么理解 .从下图中,也许你会认为这是个二维码?其实这幅图告诉我们一个道理,第二张图的点的分 ...

  4. Math.random()

    Math.random() 日期时间函数(需要用变量调用):var b = new Date(); //获取当前时间b.getTime() //获取时间戳b.getFullYear() //获取年份b ...

  5. Math.abs()方法 取绝对值

    定义和用法 abs() 方法可返回数的绝对值. 语法 Math.abs(x) 参数 描述 x 必需.必须是一个数值. 返回值 x 的绝对值. 实例 在本例中,我将取得正数和负数的绝对值: <sc ...

  6. C标准头文件<math.h>

    定义域错误可以理解为超出了函数的适用范围,如果发生了定义域错误,设errno为EDOM 如果结果不能表示为double值,则发生值域错误,如果结果上溢,则函数返回HUGE_VAL的值,设errno为E ...

  7. HDOJ 2393. Higher Math

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  8. 精灵方向移动问题[math.floor]

    local xd = math.cos(math.rad(self._direction));--self._direction方向角度 local yd = math.sin(math.rad(se ...

  9. Java学习笔记-Math类

    并非所有的类都需要main方法.Math类和JOptionPane类都没有main方法.这些类中所包含的方法主要是为了供其他类使用. package welcome; public class Tes ...

随机推荐

  1. SQL中的delete和TRUNCATE的用法

    TRUNCATE TABLE 表名 删除表中的所有行,而不记录单个行删除操作. 语法 TRUNCATE TABLE name 参数 name 是要截断的表的名称或要删除其全部行的表的名称. 注释 TR ...

  2. javascript版1024游戏源码

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  3. java基础学习笔记

    Q:    What if the main method is declared as private?  如果将主函数声明为私有类型的会怎样? A:     The program compile ...

  4. (原)error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5577534.html 在debug下使用intel的mkl库时(release下无此问题),莫名的出现 ...

  5. js原生Ajax的封装与使用

    一.原生Ajax代码的封装如下: (function() { var XHR = { createStandardXHR: function() { return new XMLHttpRequest ...

  6. sublime快捷键收藏

    快速查找(ctrl + P)输入@+函数名可以快速找到函数.输入#+文本可以快速进行文件内文本匹配.3. 多行游标功能(ctrl + D,非常实用)如何将文件中的某个单词更改为另一个?方法一:利用查找 ...

  7. PIL参考手册

    Python Imaging Library Handbook http://effbot.org/imagingbook/pil-index.htm 随机验证码的产生 import Image, I ...

  8. ubuntu Python2.7 安装PIL问题

    $sudo easy_install PIL WARNING: '' not a valid package name; please use only.-separated package name ...

  9. MotionEvent的getX(),getY()与getRawX(),getRawY()区别

    getX()是表示Widget相对于自身左上角的x坐标,而getRawX()是表示相对于屏幕左上角的x坐标值(注意:这个屏幕左上角是手机屏幕左上角,不管activity是否有titleBar或是否全屏 ...

  10. [poj 1039]Pipes[线段相交求交点]

    题意: 无反射不透明管子, 问从入口射入的所有光线最远能到达的横坐标. 贯穿也可. 思路: 枚举每一组经过 up [ i ] 和 down [ j ] 的直线, 计算最远点. 因为无法按照光线生成的方 ...