<PREV Problem:
NEXT>
Solved by 64 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Pythagorean triples

Time limit = 2 second(s)

A Pythagorean triple consists of three positive integers a, b, and c, such that a2+b2=c2. Your program should calculate N-th Pythagorean triple, considering triples to be sorted in ascending order (lexicographically by c, a, b). Triples (a, b, c) and (b, a, c) are considered to be different.

Input: Single integer number N. 0 < N < 1000000.

Output: Three integers delimited with spaces: a, b, c.

Input#1
1
Output#1
3 4 5

Input#2
3
Output#2
6 8 10

Author:
Statement by Artem Voroztsov, solution, checker & tests by Dmitriy Polischuk
15 September 2007

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 220ms

SW soft NIX
ID = 54.80.60.91