hdu 2393:Higher Math(计算几何,水题)

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

HDU
2008-10 Public Contest

Recommend

lcy   |   We have
carefully selected several similar problems for you:  2391 2389 2390 2386 2388


  计算几何,水题

  题意:给你三个数,作为三角形的三边,判断这个数是不是直角三角形。

  代码:


 1 #include <iostream>
2
3 using namespace std;
4
5 int main()
6 {
7 int i,a,b,c,T;
8 cin>>T;
9 for(i=1;i<=T;i++){
10 cin>>a>>b>>c;
11 if(a*a+b*b==c*c || b*b+c*c==a*a || a*a+c*c==b*b)
12 cout<<"Scenario #"<<i<<‘:‘<<endl<<"yes"<<endl;
13 else
14 cout<<"Scenario #"<<i<<‘:‘<<endl<<"no"<<endl;
15 cout<<endl;
16 }
17 return 0;
18 }

Freecode : www.cnblogs.com/yym2013

时间: 2024-10-18 10:57:03

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

hdu 2393 Higher Math

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

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

题意:给定三个边,判断是不是直角三角形. 析:水题,勾股定理... 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <cstring> #include <map> using namespace std; const int maxn = 100; in

HDU 6182 A Math Problem 水题

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=6182 题目描述: 输入N, 输出满足k^k <= N 的 k的个数 解题思路: 水水更健康 代码: #include <iostream> #include <cstdio> #include <string> #include <vector> #include <cstring> #include <iterator> #in

hdu 1999 不可摸数 水题。

不可摸数 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7966    Accepted Submission(s): 2024 Problem Description s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何数m,s(m)都不等于n,则称n为不可摸数. Input 包

HDU Senior&#39;s Gun (水题)

题意:给n把枪,m个怪兽,每把枪可消灭1怪兽,并获得能量=枪的攻击力-怪兽的防御力.求如何射杀能获得最多能量?(不必杀光) 思路:用最大攻击力的枪杀防御力最小的怪兽明显可获得最大能量.如果每把枪都去射杀刚好1点能量都拿不到的怪物,那简直等于把枪全丢掉. 1 //#pragma comment(linker,"/STACK:102400000,102400000") 2 #include <iostream> 3 #include <stdio.h> 4 #inc

HDU 5590 ZYB&#39;s Biology 水题

ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5590 Description ZYB(ZJ−267)在NOIP拿到600分之后开始虐生物题,他现在扔给你一道简单的生物题:给出一个DNA序列和一个RNA序列,问它们是否配对. DNA序列是仅由A,C,G,T组成的字符串,RNA序列是仅由A,C,G,U组成的字符串. DNA和RNA匹配当且仅当每

hdu 4847 Wow! Such Doge! 水题

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847 统计文本中一共有多少个“Doge” 水题 #include <cstring> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <cstdio> #includ

HDU 5578 Friendship of Frog 水题

Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5578 Description N frogs from different countries are standing in a line. Each country is represented by a lowercase letter. The distance betwee

杭电(hdu)2053 Switch Game 水题

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13113    Accepted Submission(s): 7970 Problem Description There are many lamps in a line. All of them are off at first. A series of o