Polish version    English version  
  History of OI -> I OI 1993/1994 -> Problems


 News
 About Olympic
 History of 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
I OI 1993/1994
Problems
 OI books
 National team
 Olympic camps
 Photo gallery
 Links
 SIO
 MAIN
Niebieskie ksi.eczki
I Olympiad in Informatics 1993/1994

Task: TKT
Author: Piotr Chrz±stowski-Wachtel
Triangles

I stage contest  

A finite, at least three-element set A of rational length line segments is given. We want to examine whether from every three segments of A a triangle may be built.

An input data file is an at least three-element sequence of lengths of all line segments from the set A put in some order. Every segment length (a rational number) is written in a form numerator/denominator, where numerator and denominator are positive integers not greater than 9999.

Consecutive lengths in this sequence are separated by a space or a single end-of-line character.

There should be given an answer:
TAK ("yes"), if from every three line segments of A a triangle may be built.
NIE ("no"), if from not every three line segments of A a triangle may be built.
NONSENS ("nonsense"), if the data file is not correct, i.e. does not meet the above conditions.

Examples

For the input file:

13/10 1/2 6/5 11/6 9/7 3/5 9/7 13/10 9/5 8/5
the answer is NIE, because, for example, one cannot build a triangle from line segments of lengths: 6/5 3/5 9/5.

For the input file:

1/2 3/5 2/3 4/7 1/1 4/6
the answer is TAK.

For the input file:

1/2 3/5 2/3 4/7 1 4/6
the answer is NONSENS, because 1 is not a pair of numbers separated by a character /.

Task

Write a program, that successively for every data set from a file TKT.IN generates a correct answer TAK, NIE or NONSENS, and writes it to a file TKT.OUT.

The source text of the program should be written in a file named TKT.???, where ??? are substituted by a sequence of letters appropriate for the programming language used.

The executable program should be named TKT.EXE.




Print friendly version