ACM-水题 Higher Math
来源:互联网 发布:对大数据的看法 编辑:程序博客网 时间:2024/05/05 07:59
题目
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.
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
236 77 8540 55 69
Sample Output
Scenario #1:yesScenario #2:no
#include <algorithm>#include <stdio.h>#include <iomanip>#include <iostream>using namespace std;int main(){ int a[3],t,i=1,c,d; scanf("%d",&t); while(t--) { cin>>a[0]>>a[1]>>a[2]; sort(a,a+3); c=a[0]*a[0]+a[1]*a[1]; d=a[2]*a[2]; cout<<"Scenario #"<<i<<":"<<endl; if(c==d) printf("yes\n"); else printf("no\n"); i++; cout<<endl; } return 0;}
0 0
- ACM-水题 Higher Math
- ACM--勾股定理--HDOJ 2393--Higher Math
- HDU2393 Higher Math【几何】【水题】
- Higher Math
- Higher Math
- Higher Math
- Higher Math
- Higher Math
- Higher Math
- Higher Math
- hdu 2393 Higher Math
- hd 2393 Higher Math
- HDU 2393 Higher Math
- HDU - 2393 Higher Math
- hdu 2393 Higher Math
- HDU1.2.7 Higher Math
- HDU 2393 Higher Math
- HDU 2393 Higher Math
- mysql 新增用户并设置权限
- Cocos2d-x 3.9教程:5. Cocos2d-X中事件添加回调的方法
- hdu 5656 CA Loves GCD(n个任选k个的最大公约数和)
- CDN缓存策略FAQ及更新频率
- 增量式编码器专题
- ACM-水题 Higher Math
- 反射机制实例化类,并获取类中的属性、方法、和构造器
- Unity3D 自带摇杆 拓展, CrossPlatformInputManager
- ACM-水题 吃糖果
- Tsinsen A1105 挖地雷
- 二叉树搜索
- Ruby语言基础学习九:Ruby范围、迭代器、
- Spark简介
- Cocos2d-x 3.9教程:6. 文字的显示