p118ex5 - Max is Last
Write a program where you are given a list of N distinct real numbers where 0 ≤ N ≤ 100. Take the largest item of the list and print it last. All other items in the list should remain in their original order.
The first line of input will be an integer, N (0 ≤ N ≤ 100). Next will be N real numbers.
Output the largest number at the end rounded to two decimal places. Do not rearrange the rest of the numbers and output them as inputted (rounded to two decimal places).
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 19, 2008
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Problem statement/test cases have been fixed.
It doesn't say anything about being in increasing order (I assume that's what you mean). Maybe you should read the problem statement more carefully next time.
Here's the "full" statement, since it's kind of cut off.
"Write a program to find the largest value in a collection of N real numbers, where the value of N is the first data item read by your program. The program should first print all of the numbers entered, in order, except for the largest item. Then, it should print the largest of the numbers entered."
Even though its the same as the input, its still in order from first to last entered, with the largest last.