FAVDICE - Favorite Dice

no tags 

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?


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.


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.




hide comments
DHEERAJ KUMAR: 2015-05-27 01:43:29

My 50th :D

burninggoku: 2015-05-21 17:16:00

learned something new..

Archita Goyal: 2015-02-22 08:29:27

Use double rather than float, caused me one WA!

chicapi: 2015-02-17 02:14:18

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
Ashish Sareen: 2014-12-24 21:03:22

try this... www.codechef.com/problems/RRPLAYER

Tizen: 2014-07-28 09:17:06

my 20th :D

UJtriumphsâ„¢: 2014-04-21 09:38:23

thanx@ Prakhar Agarwal

innovolt: 2014-04-16 13:58:28

mathematical stuff......

RISHABH JAIN: 2013-09-01 16:36:59

nice question

moustafa maher: 2013-04-18 20:41:20

All thanks to salem

Added by:Matthew Reeder
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