시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB22181392.857%

문제

Björn likes the square root of two, √2 = 1.41421356 . . . very much. He likes it so much that he has decided to write down the first 10 000 digits of it on a single paper. He started doing this on an A4 paper, but ran out of space after writing down only 1250 digits. Being pretty good at math, he quickly figured out that he needs an A1 paper to fit all the digits. Björn doesn’t have an A1 paper, but he has smaller papers which he can tape together.

Taping two A2 papers together along their long side turns them into an A1 paper, two A3 papers give an A2 paper, and so on. Given the number of papers of different sizes that Björn has, can you figure out how much tape he needs to make an A1 paper? Assume that the length of tape needed to join together two sheets of papers is equal to their long side. An A2 paper is 2−5/4 meters by 2−3/4 meters and each consecutive paper size (A3, A4, . . . ) have the same shape but half the area of the previous one.advantage in the game. But unfortunately Leo died, so it is now up to you to finish this. Write a program which, when playing against Leo’s computer for several rounds, wins at least 80% of them.

입력

The first line of input contains a single integer 2 ≤ n ≤ 30, the A-size of the smallest papers Björn has. The second line contains n − 1 integers giving the number of sheets he has of each paper size starting with A2 and ending with An. Björn doesn’t have more than 109 sheets of any paper size.

출력

If Björn has enough paper to make an A1 paper, output a single floating point number, the smallest total length of tape needed in meters. Otherwise output “impossible”. The output number should have an absolute error of at most 10−5.

예제 입력 1

4
1 0 5

예제 출력 1

1.60965532263

예제 입력 2

3
0 3

예제 출력 2

impossible

출처

Contest > KTH Challenge > KTH Challenge 2015 G번

  • 문제를 만든 사람: Ulf Lundström