LPRISON - The Lucky Prisoner
(Maybe) someday there is a planet used to jail much prisoners from universe. One time, the prison manager collects all of prisoners, with handcuff in their hand locked. He orders to officers to unlock all handcuffs. Then, he orders to officers to look at prisoners whose number can divided by two. If his/her handcuff is locked, the open it, otherwise, lock it. Then, he orders again to all officers to look at prisoners whose number can divided by three, and so on.
You, the universe criminal researcher, is requested to calculate the environmental criminal impact by calculating ratio of freed prisoners about all prisoners to the number of prisoners are known.
Input
Line 1 contains one integer T (1 <= T <= 100) number of test cases. Then T next lines contains one number K (1 <= K <= 101000), the number of prisoners.
Output
Output contains K lines, contains the probability of freed prisoners about all prisoners. The probability precision is 10-500 with bankers' rounding method.
Example
Input: 2
5
100
Output (split for readability) :
0.40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0.10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Whitespace Explanation:
If there no input in any line, then do not print any line :)) Sorry for inconvenience. >:)
hide comments
vishu:
2015-07-11 02:01:22
@admin my code works fine on ideone but here its giving NZEC error.
|
|
Alex Anderson:
2011-05-31 05:49:33
That was super bothersome. Why do I need to guess that the author means "Round up" when he says using "Bankers' Approximation" and every other website I checked for what "Bankers' Approximation" meant said "Round half to Even"
|
|
tʰɒŋ toŋ ʨĩ:
2011-05-31 05:49:33
There are empty lines in the input.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
:D:
2011-05-31 05:49:33
You should print exactly 500 digits in all cases. There is no tolerance for errors and that's why rounding method is specified. You can and should solve it without using floats. |
|
Oleg:
2011-05-31 05:49:33
do you have special judge that check if answer +- 10^-500 ? or you just compare as strings ?
|
|
:D:
2011-05-31 05:49:33
There are empty lines in the input. It would be good if that was corrected. Probably a lot of WA'a are because of that, from people who are not so proficient in python... like me! Last edit: 2011-03-21 21:00:50 |
|
Suprabh Shukla:
2011-05-31 05:49:33
why is the source limit so strict ... will this not make it near-impossible to submit in languages like C. |
|
Clément Sommelet:
2011-05-31 05:49:33
Hi, do you confirm that handcuffs are all opened at the beginning?
|
|
Lukmanul Hakim:
2011-05-31 05:49:33
Ok, edited... :D |
|
:D:
2011-05-31 05:49:33
Could you break the example output and note that it's just for readability. I had to copy problem description to editor to read it.
|
Added by: | Lukmanul Hakim |
Date: | 2010-11-09 |
Time limit: | 1.584s-4.578s |
Source limit: | 1024B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | My Own Problem |