시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3 1 1 33.333%

문제

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.

Write a program which examines whether among the line segments - lengths of which are written in the standard input - 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 standard output. If there exist no such triple, the program writes one word NIE ("no") in the file standard output.

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

입력

In the standard input there is a finite sequence of at least three positive integers not greater then 1,000,000,000, 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 standard input are written correctly and your program need not verify that.

출력

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

예제 입력 1

250
1
105
150
325
99999
73
0

예제 출력 1

250 105 150

예제 입력 2

105
325
55
12555
1700
0

예제 출력 2

NIE

출처

Olympiad > Polish Olympiad in Informatics > POI 1994/1995 > Stage 2 3번

  • 스페셜 저지를 만든 사람: koosaga