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