FINDTRI - Find Right Triangle
Given natural number N you have to find a right triangle let the lengths of its sides are a, b, c.
This right triangle must satisfy:
- a, b, c are positive integers.
- a < b < c.
- c - b = 1.
- a = N.
Input
The first fine of input file has one integer T (1 <= T <= 105) the number of test cases.
T lines follow, each consisting of one integer N (1 <= N <= 109)
Output
if there is such right triangle then output its side lengths a, b, c respectively otherwise output -1.
Example
Input: 3 3 4 5 Output: 3 4 5 -1 5 12 13
hide comments
abdou_93:
2013-05-09 21:37:27
Please check my solution
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-05-01 15:17:12
too easy using math algebra... O(1) solution exists, imho this problem belong to tutorial.
|
Added by: | Hasan Jaddouh |
Date: | 2013-05-01 |
Time limit: | 1.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own problem |