Submit | All submissions | Best solutions | Back to list |
FAVDICE - Favorite Dice |
BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sided unbiased die with the push of a button. Now BuggyD wants to learn more about his die, so he raises a question:
What is the expected number of throws of his die while it has N sides so that each number is rolled at least once?
Input
The first line of the input contains an integer t, the number of test cases. t test cases follow.
Each test case consists of a single line containing a single integer N (1 <= N <= 1000) - the number of sides on BuggyD's die.
Output
For each test case, print one line containing the expected number of times BuggyD needs to throw his N-sided die so that each number appears at least once. The expected number must be accurate to 2 decimal digits.
Example
Input: 2 1 12 Output: 1.00 37.24
Added by: | Matthew Reeder |
Date: | 2006-10-29 |
Time limit: | 1s |
Source limit: | 30000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | Al-Khawarizm 2006 |
hide comments
|
||||||||
2015-05-27 01:43:29 DHEERAJ KUMAR
My 50th :D |
||||||||
2015-05-21 17:16:00 burninggoku
learned something new.. |
||||||||
2015-02-22 08:29:27 Archita Goyal
Use double rather than float, caused me one WA! |
||||||||
2015-02-17 02:14:18 chicapi
Please correct the typo "die" -> "dice"? [reply by cyclops: That is not a typo. Die is the singular of dice.] Last edit: 2015-02-17 02:31:29 |
||||||||
2014-12-24 21:03:22 Ashish Sareen
try this... www.codechef.com/problems/RRPLAYER |
||||||||
2014-07-28 09:17:06 Tizen
my 20th :D |
||||||||
2014-04-21 09:38:23 UJtriumphsâ„¢
thanx@ Prakhar Agarwal |
||||||||
2014-04-16 13:58:28 innovolt
mathematical stuff...... |
||||||||
2013-09-01 16:36:59 RISHABH JAIN
nice question |
||||||||
2013-04-18 20:41:20 moustafa maher
All thanks to salem |