<PREV Problem:
NEXT>
Solved by 64 users: ...
UserDateAttemptTimeCMSC
mishik12 oct 2007C++2400.60231 
mishik13 apr 2008C++2700.57235 
DAV10 mar 2010C++2000.13240 
DAV10 mar 2010C++1900.12250 
DAV10 mar 2010C++1800.10252 
velomeloman14 dec 2008C++800.40255 
checkil17 dec 2008C++100.39258 
velomeloman14 dec 2008C++900.40258 
velomeloman13 dec 2008C++700.40260 
lutyj23 jan 2008C++200.75260 
gchebanov22 oct 2012C++200.06262 
mishik10 oct 2007C++1200.52263 
mishik10 oct 2007C++1100.48274 
pmnox05 feb 2009C++300.68274 
VladimirChelnokov14 sep 2007C++301.34295 
VladimirChelnokov14 sep 2007C++201.23301 
arti11 feb 2008C++400.79310 
VladimirChelnokov14 sep 2007C++800.96312 
gchebanov23 oct 2012C++300.05319 
zmy10 dec 2007C++100.95321 
VladimirChelnokov14 sep 2007C++600.95321 
Languages
C++
46
Kylix
12
Java
3
C
3
FPC
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

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 180ms

SW soft NIX
ID = 18.207.130.162