HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > C. T. 2011 > problem:


Triangle

Volume problems

• Cow Sorting
• Colored hills
• Connected components
• Going to the Movies
• Word power
• Word Statistics
• Brackets
• Profits
• Triangle
• Istanbul
• Butterfly
• Buying hay
• Fleas
• Babel tower
• Pizza delivery
• Railway turnout
• Door lock

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/2000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem Description

The life style was significantly different in ancient World. Magic was used as a primary technique to perform many daily tasks such as protection, healing, and entertainment. The purpose of the magic was to compel the help of divine powers. The challenge between the Moses and magicians is a well-known story. The magicians threw their cords and sticks, and they appeared to turn into serpents. Then, Moses threw his walking stick and it really turned into a serpent and swallowed the magicians’ machinations.
You are not going to make any magic or machination in this problem, on the contrary, the only magic required for this problem is its solution. You are given a magic stick that has several straight segments, with joints between the segments that allow the stick to be folded. Depending on the segment lengths and how they are folded, the segments of the stick can be arranged to produce a triangle. You are to determine the maximum area that could be enclosed by the triangle formed by folding the stick. Only the end points of the stick can touch each other. For example, the stick shown below on the left has five segments and four joints. It can be folded to produce a triangle as shown on the right.

Input

The input begins with a line containing an integer N (1<= N <= 100), where N is the number of the segments of the magic stick. Following this, there are N integers Si (1<= Si <= 100) in a line representing the lengths of segments starting with segment 1 and ending with segment N.

Output

Output displays the maximum total enclosed area that can be obtained by folding the magic stick as a form of triangle from the given points. The result should be rounded and displayed to the nearest hundredth.

Example

input output

3
3 4 5

6.00

 

Для отправки решений необходимо выполнить вход.

www.contester.ru