zoukankan      html  css  js  c++  java
  • 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
     
    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

  • 相关阅读:
    C#判断闰年
    C#计算时间,107653秒是几天几小时几分钟几秒?
    两个值交换,不使用第三个中间变量做缓存。实现方法
    element UI dialog 固定高度 且关闭时清空数据
    JS
    PHP
    element UI 上传文件成功后
    windows环境安装vue-cli及webpack并创建vueJs项目
    PHP
    mysql点滴记录 三 (基础操作)
  • 原文地址:https://www.cnblogs.com/yym2013/p/3749648.html
Copyright © 2011-2022 走看看