Question one hundred and twenty-one: Right Triangle

Source: Internet
Author: User

[Plain] Description
 
After reading three non-zero integers, determine whether these three values can represent the three sides of a right triangle.
 
Input
 
The first line is the number of test data groups n. There are n rows below. Each row is a space-separated integer of the int type, representing the three sides of the triangle.
 
Output
 
The output is n rows, corresponding to the input result of n rows. Determine whether the input three values can represent the three sides of a right triangle. If the input value can be 1, if the input value cannot be 0.
 
Sample Input
 
 
2
3 4 5
5 6 1
 
Sample Output
 
 
1
0

Description

After reading three non-zero integers, determine whether these three values can represent the three sides of a right triangle.

Input

The first line is the number of test data groups n. There are n rows below. Each row is a space-separated integer of the int type, representing the three sides of the triangle.

Output

The output is n rows, corresponding to the input result of n rows. Determine whether the input three values can represent the three sides of a right triangle. If the input value can be 1, if the input value cannot be 0.

Sample Input


2
3 4 5
5 6 1

Sample Output


1
0
 


[Plain] # include <stdio. h>
Main ()
{
Int n;
Int;
Int B;
Int c;
 
Scanf ("% d", & n );
 
While (n --)
{
Scanf ("% d", & a, & B, & c );
 
If (a> 0 & B> 0 & c> 0)
{
If (a + B> c & B + c> a & a + c> B)
{
If (a * a + B * B = c * c | a * a + c * c = B * B | B * B + c * c = *)
{
Printf ("1 ");
}
Else
{
Printf ("0 ");
}
}
Else
{
Printf ("0 ");
}
}
Else
{
Printf ("0 ");
}
 
If (n> 0)
Printf ("\ n ");
}
}

# Include <stdio. h>
Main ()
{
Int n;
Int;
Int B;
Int c;

Scanf ("% d", & n );

While (n --)
{
Scanf ("% d", & a, & B, & c );

If (a> 0 & B> 0 & c> 0)
{
If (a + B> c & B + c> a & a + c> B)
{
If (a * a + B * B = c * c | a * a + c * c = B * B | B * B + c * c = *)
{
Printf ("1 ");
}
Else
{
Printf ("0 ");
}
}
Else
{
Printf ("0 ");
}
}
Else
{
Printf ("0 ");
}

If (n> 0)
Printf ("\ n ");
}
}

 
 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.