PITAGORA - Right Triangle
When Ant studied in middle school, he liked math very much and did well in it. One day, his teacher taught him the Pythagoras theorem (which was also called Pythagorean theorem). Pythagorean number is a group of three integers a, b, c (a^2 + b^2 = c^2) which can constitute the edges of a right triangle. Ant was interested in Pythagorean number. He thought every integer n (n > 2) could be the smallest integer of Pythagorean number. He also found that, if the integer was n (n > 2) a prime, there would be only one group of Pythagorean number whose smallest integer was n. Now here comes the question. Given you a prime n, calculate the Pythagorean number whose smallest one is n.
Input
There are several test cases. For each test case, there is a single line contains a prime n (n > 2 and n < 40000)
Output
For each test case, output all the three integers of the Pythagorean number separated by single spaces which is sorted in ascending order and n is the smallest of the three integers.
Example
Input: 3 5 Output: 3 4 5 5 12 13
hide comments
Parshant garg:
2013-05-06 01:39:00
@Francky but i was helpless.. please help me and tell me what is the problem in my code
|
|
Francky:
2013-05-06 01:39:00
@ Parshant garg : 123 is not a prime number.
|
|
Parshant garg:
2013-05-06 01:39:00
nice one.. Last edit: 2013-04-29 17:50:08 |
Added by: | [UNI]Jonathans |
Date: | 2013-03-15 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | TJU 2012 Team Selection |