ACM 直角三角形判断
来源:互联网 发布:关联规则算法推荐系统 编辑:程序博客网 时间:2024/05/21 10:33
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
#include<stdio.h>main(){ int t,i,j,k,l=0,flag=0; scanf("%d",&t); while(t--) { flag=0; l++; scanf("%d %d %d",&i,&j,&k); if(i*i+j*j==k*k||i*i+k*k==j*j||k*k+j*j==i*i) flag=1; printf("Scenario #%d:\n",l); if(flag==1) printf("yes\n\n"); else printf("no\n\n"); } return 0;}
- ACM 直角三角形判断
- d014: 判断直角三角形
- 直角三角形的判断
- 1030: 判断直角三角形
- 【面试题】判断是不是直角三角形
- zzuli OJ 1030: 判断直角三角形
- 直角三角形
- 直角三角形
- 直角三角形
- 直角三角形
- 直角三角形
- 直角三角形
- 直角三角形
- 输入三角形三边判断是否是直角三角形
- 暑假编程训练---K:判断是否直角三角形
- 判断是否是直角三角形的算法研究
- 根据三边判断是否为直角三角形
- 【SzNOI语法百题】【d014】判断直角三角形
- WIFI基本知识整理
- 【Hibernate — 映射实体关联关系】
- MPAndroidChart开源图表框架—-柱状图(二)
- android 自动检测更新,下载,安装
- asp.net 数据验证控件的使用实例
- ACM 直角三角形判断
- dalivik虚拟机
- 递归搜索MP3文件
- Android Studio导入第三方库(SlidingMenu)教程
- AndroidAnnotations 注解框架的优势对比、配置及使用教程
- D3D11无双(2):渲染一个3D彩色立方体
- windos下的脚本到Linux下运行出现问题
- Xcode准确定位产生异常的代码行
- leetcode——98——Validate Binary Search Tree