Usaco 2014 March gold P2 sabotage

Source: Internet
Author: User

1.Damage{DoldQuestion2}

Sabotage. PAS/C/CPP

[Problem description]

Paul, the top enemy of Farmer John, decided to destroy John's milking equipment. The milking equipment is arranged in a row with N (3 <= n <= 100000) milking machines, where the I-th milking machine produces m_ I Unit (1 <= m_ I <= 10,000) milk.

Paul plans to cut off a continuous milking machine from the I-th milking machine to the J-th milking machine (2 <= I <= j <= N-1 ). Note that he does not want to disconnect the first or last milking machine because it will make his plan too easy to find. Paul's goal is to minimize the average milk yield of other machines. Paul planned to remove at least one milking machine.
Calculate the minimum average milk yield for the remaining machines.

[File input]

The first behavior is two integers n.

Next line 2. n + 1, each line has an integer, indicating m_ I.

[File output]

The output is a row in total. An integer indicates the minimum average milk yield, which is rounded to three decimal places.

[Example 1]

5

5

1

7

8

2

[Output Example 1]

2.667

[Example]

Destroy 7 and 8, with 5, 1, and 2 left.

Usaco 2014 March gold P2 sabotage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.