|
|||||||
|
Sponsor
Since childhood a swimmer Daniel Waterproof has been being sponsored by his uncle, a rich businessman. At the end of Daniel's swimming career his uncle has decided to fund a special prize for him. Daniel has been storing in a computer all the consecutive times scored while training as well as during competitions in his crown contest - 50 m free style, so his uncle has devised that the amount of the prize would depend on the length of the longest decreasing sequence of scores which can be found in the consecutive data. The prize amount in dollars would be hundred times greater than the length of this sequence. The input data is a nonempty sequence of consecutively scored results during the whole Daniel's career. The scores are measured in seconds with one thousandth of a second precision. Every score is a number from the closed interval [20, 30], having exactly three digits after the decimal point. The consecutive scores are separated by a space or a single end-of-line character. The answer is an integer equal to the amount of the prize in dollars or the word NONSENS ("nonsense"), if the data file is not correct, i.e. does not meet the above conditions. ExampleFor the input file: 22.155 23.252 22.586 22.450 23.327 22.228 22.087 23.091 22.190 22.140 22.057 22.123 22.359 22.190 22.140 22.523 22.384 22.488 23.201 23.050containing twenty consecutive scores the answer is number 700, for the maximal length of decreasing sequence of the scores equals 7. One can even indicate two such decreasing sequences of length 7. They are made of the scores: 2nd, 3rd, 4th, 6th, 9th, 10th and 11th: 23.252 22.586 22.450 22.228 22.190 22.140 22.057, and 2nd, 3rd, 4th, 6th, 9th, 10th and 12th: 23.252 22.586 22.450 22.228 22.190 22.140 22.123. For the input file: 22 22.4357 22.5the answer is the word NONSENS, for every one of the three scores has been written not meeting the given rules. TaskWrite a program, that successively for every data set from a file SPO.IN generates a correct answer: an integer number or the word NONSENS, and writes it to a file SPO.OUT. The source text of the program should be written in a file named SPO.???, where ??? are substituted by a sequence of letters appropriate for the programming language used. The executable program should be named SPO.EXE. |