## 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.

### Input

The first line of input will be an integer, N (0 ≤ N ≤ 100). Next will be N real numbers.

### Output

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).

`4`
`3`
`2.7`
`5.12`
`-0.63`

### Sample Output

`3.00`
`2.70`
`-0.63`
`5.12`

Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

• (0/0)
Can someone tell me why the second output for me is just 0?

• (0/0)
Try this test case:

3
-61.2
-0.1
-28.7

• (1/2)
I tried the test case and it works exactly. I tried some of my own as well and it works but for some reason the judge doesn't accept case 2 and 3. Can someone look at it and tell me what I am missing?

• (1/0)
Try not to remove elements of the list while iterating over it

• (0/0)
OK, it really didn't make sense before.
Problem statement/test cases have been fixed.

• (1/9)
The example is retarded... its not even in order

• (1/0)
I beg to differ.

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."

• (0/3)
shouldn't the output be:

3.00
2.70
-0.63
5.12

Even though its the same as the input, its still in order from first to last entered, with the largest last.

• (0/3)
thx joyce.

• (1/4)
wait, how do u do this question. Do you output it one by one, or wait until u have all the imputs?