Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Announcement
Problems
Submit Problem
Status (Online)
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID: 
Password:
  Register

Max Sequence II
Time Limit:3000MS  Memory Limit:65536K
Total Submit:422 Accepted:60 Special Judged

Description

Given N real numbers a1, a2, ¡­, aN, you are to write a program to calculate P as defined below.

Input

The input consists of several test cases. Each test case consists of two lines:
Line 1: A single positive integer N ¡Ü 100,000.
Line 2: N real numbers a1, a2, ¡­, aN (|ai| ¡Ü 30 for all i s.t. 1 ¡Ü i ¡Ü N) which are either integral or accurate to one digit after decimal point.
Process to the end of input.

Output

For each test case, output P in scientific notation in a single line. If P is equal to zero, output ¡°0.000¡±. If 1 ¡Ü |P| < 10, output P directly with its fractional part rounded to three decimal places. In any other cases, output P in the format xEn where P = x ¡Á 10n (1 ¡Ü |x| < 10 and n is an integer). x should also be rounded to three digits after decimal point.

Sample Input

5
-5.0 2.0 3.0 -2.0 0.5
3
-1 0 -1

Sample Output

6.000E1
0.000

Hint
Built-in floating-point types provided by the compilers may not hold P.

Source
POJ Monthly--2006.05.28, Static

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Copyright Reserved 2003-2005 Ying Fuchen,Xu Pengcheng
Any problem, Please Contact Administrator