File size: 1,948 Bytes
761e24d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
<p>
In the game <em>Theatrhythm Final Fantasy</em>, you poke a screen with a stick
to the beat of various songs. The goal is to poke the screen as accurately as
possible. If you hit a note at just the right time, you're awarded a
<strong>critical</strong>. Every song is broken into 20 sections, and if you get a
<strong>critical</strong> on every note in a section, then you get that section's
golden <strong>critical bar</strong>.
</p>
<p>
You would like to collect all 20 <strong>critical bars</strong> for every song.
Songs vary in difficulty, but each song has a fixed probability <strong>p</strong>, which
is the chance that you manage to secure any one <strong>critical bar</strong>
on a single playthrough.
The chances are independent, so for any given pair of sections, the probability of
getting both <strong>critical bars</strong> in a single playthrough is <strong>p</strong><sup>2</sup>, and so on.
<strong>Critical bars</strong> are saved between playthroughs, so you don't have to win
all of the <strong>critical bars</strong> in a single play of the song. You might win
the first 10 on one play, and then the last 10 on another.
</p>
<p>
On average, how many times will you have to play a song to win all 20
<strong>critical bars</strong>?
</p>
<h3>Input</h3>
<p>
Input begins with an integer <strong>T</strong>, the number of songs
you'll play. For each song, there is a line containing a floating point number,
<strong>p</strong>, the probability of winning any particular
<strong>critical bar</strong> on a single play of the song.
</p>
<h3>Output</h3>
<p>
For each song, output the expected number of times you need to play the song
before acquiring all 20 <strong>critical bars</strong>, rounded to five decimal points.
</p>
<p>
Absolute errors of up to 10<sup>-5</sup> will be ignored.
</p>
<h3>Constraints</h3>
<p>
1 ≤ <strong>T</strong> ≤ 20 <br />
0.01 ≤ <strong>p</strong> ≤ 1.0 <br />
</p>
|