BlueBook

p287ex3 - Min

Find the minimum in a list of real numbers.

Input

The first line contains an integer N (1 ≤ N ≤ 10 000). Each of the following N lines contains one real number xi (-1000 < xi < 1000).

Output

The minimum of the N real numbers given, rounded to two decimal places.

Sample Input

2
10.1
12.3

Sample Output

10.10

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 26, 2008

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

Comments (Search)

It's not working for me. Keeps saying error but gives no error message whatsoever.

You're not printing the min?

i tried my code and it easily worked on ideone. When i put it here, it gives me -0.03 and says its wrong.

Do note that they are reals, not integers. This would be significant in a language like C++ or Java.

Your program handles negative numbers weirdly. I searched around a bit, and by casting input() to float, it seemed to work more correctly, though it still received RTE on ideone.

So i have to change my input to a float?

even when i use the str(round()) method it still doesnt work, saying (line 8, type str does not define _round_.

wait, what do you mean by "by casting input() to float, it seemed to work"?

float(input()) instead of input() made it work for me


It seems you are fundamentally misunderstanding the suggestion.

1. input() returns a string.
2. float(input()) casts said string to a float (aka a double or a real).
3. int(input()) casts said string to an integer.

Since N is an integer, clearly after reading it in, you should treat it as an integer.

As for the N real numbers, well, they're reals, so you should be casting them to floats.


PS: To reply to a comment, don't just type it into the bottom. Click the + sign in the top-right corner.