Higher Math

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2219    Accepted Submission(s): 1219

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
 
Recommend
lcy   |   We have carefully selected several similar problems for you:  2391 2389 2390 2386 2388 

 
  计算几何,水题
  题意:给你三个数,作为三角形的三边,判断这个数是不是直角三角形。
  代码:
 #include <iostream>

 using namespace std;

 int main()
{
int i,a,b,c,T;
cin>>T;
for(i=;i<=T;i++){
cin>>a>>b>>c;
if(a*a+b*b==c*c || b*b+c*c==a*a || a*a+c*c==b*b)
cout<<"Scenario #"<<i<<':'<<endl<<"yes"<<endl;
else
cout<<"Scenario #"<<i<<':'<<endl<<"no"<<endl;
cout<<endl;
}
return ;
}

Freecode : www.cnblogs.com/yym2013

hdu 2393:Higher Math(计算几何,水题)的更多相关文章

  1. HDU 2393 Higher Math (判断直角三角形)

    题意:给定三个边,判断是不是直角三角形. 析:水题,勾股定理... 代码如下: #include <iostream> #include <cstdio> #include & ...

  2. HDU 2393 Higher Math

    #include <cstdio> #include <string> using namespace std; void swap(int& a,int& b ...

  3. HDOJ 2393. Higher Math

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

  4. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  5. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  6. HDU 5590 ZYB's Biology 水题

    ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

  7. HDU 4584 Building bridges (水题)

    Building bridges Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) ...

  8. hdu 1005:Number Sequence(水题)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  9. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

随机推荐

  1. linux 命令free -m 命令结果分析

    free -m 命令详解 free -m 分析系统内存使用情况:

  2. 9.10---堆箱子问题(CC150)

    1,牛客网的解题思路:其实这就是求一个最长的递增子序列.   以某一个箱子结尾的最大高度=放在它上面的所有类型中高度最大的那个+他自己的高度. import java.util.*; public c ...

  3. django 实战 - eLeave Form

    需求: 实现请假单的电子审批 1. 支持国际化 2. 支持模型级别的访问记录 here we go: 这里会写一系列的文章,来记录我实战的过程,由于接触django没多久,难免有疏漏之处,望拍砖不要太 ...

  4. UITableView 系列之自定义 UITableViewCell

    http://www.360doc.com/content/14/0225/14/11029609_355567657.shtml

  5. SQL Server中的索引

    1 SQL Server中的索引 索引是与表或视图关联的磁盘上结构,可以加快从表或视图中检索行的速度.索引包含由表或视图中的一列或多列生成的键.这些键存储在一个结构(B 树)中,使 SQL Serve ...

  6. c#.net对excel的操作——创建一个excel报表两个sheet就是2个表分别添加内容

    添加引用:Microsoft.Office.Interop.Excel //创建excel对象,就是实例化一个excel对象            Application excel=new Appl ...

  7. python读写文件时中文的转码问题

    读写文件都要将中文转为unicode字符. 读文件: u = unicode(s, 'gbk') 这里不能使用encode 写文件: u = encode('utf')

  8. 在Linux服务器上配置phpMyAdmin

    使用php和mysql开发网站的话,phpmyadmin是一个非常友好的mysql管理工具,并且免费开源,国内很多虚拟主机都自带这样的管理工具,配置很简单,接下来在linux服务器上配置phpmyad ...

  9. FindinFiles - Windows文件内查找插件

    FindInFiles for Windows 今天分享一个不错的插件工具:FindInFiles.如其名,其功能和Visual Studio的Ctrl+H快捷键类似,方便Windows使用者在资源管 ...

  10. 1616 最小集合 51NOD(辗转相处求最大公约数+STL)

    1616 最小集合 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题  收藏  关注 A君有一个集合. 这个集合有个神奇的性质. 若X,Y属于该集合,那么X与Y的最大 ...