Polish version    English version  
  Historia OI -> II OI 1994/1995 -> Zadania


 Aktualności
 O olimpiadzie
 Komitety
 XVIII OI 2010/2011
 Historia OI
XVII OI 2009/2010
XVI OI 2008/2009
XV OI 2007/2008
XIV OI 2006/2007
XIII OI 2005/2006
XII OI 2004/2005
XI OI 2003/2004
X OI 2002/2003
IX OI 2001/2002
VIII OI 2000/2001
VII OI 1999/2000
VI OI 1998/1999
V OI 1997/1998
IV OI 1996/1997
III OI 1995/1996
II OI 1994/1995
Wyniki III etapu
Wyniki I etapu
Zadania
I OI 1993/1994
 Książeczki OI
 Reprezentacja
 Obozy Olimpiady
 Galeria zdjęć
 Ciekawe odsyłacze
 OIG LiveCD
 IV OIG 2009/2010
 Historia OIG
 SIO
 MAIN
Ten dokument nie jest dostępny w polskiej wersji językowej.

Niebieskie ksi.eczki
II Olympiad in Informatics 1994/1995

Task: TRO
Author: Piotr Chrząstowski-Wachtel
Triangles

II stage contest  

In a finite sequence of positive integers not greater than a billion, representing lengths of line segments, we want to find three numbers such that one can build a triangle from segments of such lengths.

Task

Write a program which examines whether among the line segments - lengths of which are written in the text file TRO.IN - there exist three such that one can build a triangle from them. If so, the program writes the lengths of those three segments in the file TRO.OUT. If there exist no such triple, the program writes one word NIE ("no") in the file TRO.OUT.

If there exist many triples of line segments of lengths written in the file TRO.IN such that one can build a triangle from them, then your program should find and write only one (arbitrary) of them.

Input

In the file TRO.IN there is a finite sequence of at least three positive integers not greater then 1000000000, terminated by the number 0. Each number is written in a separate line. Positive numbers are lengths of line segments, and the number 0 denotes the end of the data.

The data in the file TRO.IN are written correctly and your program need not verify that.

Output

In the file TRO.OUT there should be either one word NIE, or three lengths of line segments chosen from the file TRO.IN, from which one can build a triangle. The lengths are separated by single spaces.

Examples

For the file TRO.IN:
105
325
55
12555
1700
0
in the file TRO.OUT there should be one word:
NIE

For the file TRO.IN:

250
1
105
150
325
99999
73
0
the following three numbers in the file TRO.OUT are a sample correct solution:
250 105 150

Your program should look for the file TRO.IN in the current directory and create the file TRO.OUT also in the current directory. The source file containing the program written by you should be named TRO.???, where ??? are substituted by at most three-letter abbreviation of the programming language used. The same program in an executable form should be written in a file TRO.EXE.




Wersja do druku