Submit | All submissions | Best solutions | Back to list |
BLLUCK - Coincidence |
Toriel is planning to create a game with prize. In this game, there are N players and N boxes each containing a piece of paper with a player's name written on it. Each player has a unique name and each box contains a different name. There are at most 1000 players playing.
Then, each player take 1 box at random such that every player got a different box. The more player got a box containing their name, the bigger the prize is. To prepare the prize, Toriel needs your help to calculate the expected number of player to get their own name.
Input.
First line is T, number of games (T<1000). Next T lines each contains N for each game.
Output
For each game, output the expected number of players to get the box containing their own name. Output exactly 6 digits after decimal points.
Example
Input: 1
1 Output: 1.000000
Added by: | Andy |
Date: | 2016-11-23 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |
Resource: | BLPCS5 |
hide comments
2019-02-28 17:21:34
easy one |
|
2017-06-28 08:02:24 darryl
wow |
|
2017-03-06 13:11:55 gomathi ganesan
can anybody give some more test cases? |
|
2017-01-31 04:13:32 Jacob Plachta
Bounds need to be stated: 0 <= N <= 1000 |
|
2016-11-24 18:21:40 Francky
a) hum hum... ok.. hum hum. AC. b) On every problem where output is float, one should use 'Ignore fp errors 1e-?' as judge. |
|
2016-11-24 17:49:44 Andy
Input: 2 1 1 Output: 1.000000 1.000000 |
|
2016-11-24 15:48:42 abdou_93
more test cases |