ACM水题系列 HDOJ2393
来源:互联网 发布:交通大数据应用 编辑:程序博客网 时间:2024/06/08 06:09
Higher Math
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5153 Accepted Submission(s): 1663Problem 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 <iostream>#include <math.h>using namespace std;int main(){ int t,a[3],flag=1; cin>>t; while(t--) { for(int i=0;i<3;i++) cin>>a[i]; if(a[0]*a[0]+a[1]*a[1] == a[2]*a[2]||a[0]*a[0] == a[1]*a[1] + a[2]*a[2]||a[0]*a[0] == a[1]*a[1] - a[2]*a[2]) cout<<"Scenario #"<<flag<<":"<<endl<<"yes"<<endl<<endl; else cout<<"Scenario #"<<flag<<":"<<endl<<"no"<<endl<<endl; flag++; } return 0;}
0 0
- ACM水题系列 HDOJ2393
- ACM水题系列 HDOJ1038
- ACM水题系列 HDOJ2629
- ACM水题系列 HDOJ2550
- ACM水题系列 HDOJ2673
- ACM水题系列 HDOJ2093
- ACM水题系列 HDOJ 1064
- ACM水题系列 HDOJ 1326
- ACM水题系列 HDOJ 1061
- acm教主系列
- ACM动态规划系列
- ACM(贪心系列)
- 每日一题系列 - Compacting Stickers (ACM竞赛题)
- ACM-简单题之不容易系列之一——hdu1465
- acm题目之教主系列
- 南阳acm士兵杀敌系列
- acm题
- acm题
- 基础练习二
- Hope is a good thing, maybe the best of things and no good thing ever dies !
- Max Points on a Line
- 离散数学实验课中有趣的题目
- 学习shader之前必须知道的东西之计算机图形学(一)渲染管线
- ACM水题系列 HDOJ2393
- [Unity3D]图形渲染优化、渲染管线优化、图形性能优化
- 网站页面度量与细分
- 001Android学习之旅——Android环境配置(Eclipse)
- ACM水题系列 HDOJ2629
- Android View 中view.requestLayout() 与 invalidate()
- kali 安装步骤 安装失败 kali install fail 已解决
- rebar 构建rel小问题
- ACM贪心 HDOJ1050