zoukankan      html  css  js  c++  java
  • hdu2393Higher Math

    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
    #include<iostream>
    #include<cstring>
    #include<cstdio>
    #include<cmath>
    
    using namespace std;
    
    int main()
    {
        int z,t = 0;
        cin>>z;
        while(z--)
        {
            printf("Scenario #%d:
    ",++t);
            int a,b,c;
            cin>>a>>b>>c;
            if(a>b) swap(a,b);
            if(b>c) swap(b,c);
            if(a*a+b*b == c*c) cout<<"yes"<<endl<<endl;
            else cout<<"no"<<endl<<endl;
        }
        return 0;
    }
  • 相关阅读:
    8.6 First_value和Last_value
    iOS_第3方类库_側滑选项卡SlideSwitchView
    公开的函数把函数作为參数
    .NET 框架简单介绍
    HDU-3577-Fast Arrangement-区间更新
    拥抱PBO(基于项目的组织)聚焦核心价值创造
    一个使用sbt编译的JNI C++ 的模板
    BestCoder Round #1
    饭统网倒闭:不创新、不放权就是作死 .
    【SSH 基础】浅谈Hibernate关系映射(3)
  • 原文地址:https://www.cnblogs.com/wos1239/p/4557070.html
Copyright © 2011-2022 走看看