Submit | All submissions | Best solutions | Back to list |
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. >:)
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 |
hide comments
2015-07-11 02:01:22 vishu
@admin my code works fine on ideone but here its giving NZEC error. please look into it.My id is 14643648 |
|
2011-05-31 05:49:33 Alex Anderson
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" Note: Just round normally. 5 goes up. 4 goes down. Last edit: 2011-05-28 15:45:03 |
|
2011-05-31 05:49:33 tʰɒŋ toŋ ʨĩ
There are empty lines in the input.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
2011-05-31 05:49:33 :D
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. |
|
2011-05-31 05:49:33 Oleg
do you have special judge that check if answer +- 10^-500 ? or you just compare as strings ? if I print "1.0" for K = 1 it will be judged correct or I should print 500 zeros after decimal point ? |
|
2011-05-31 05:49:33 :D
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 |
|
2011-05-31 05:49:33 Suprabh Shukla
why is the source limit so strict ... will this not make it near-impossible to submit in languages like C. |
|
2011-05-31 05:49:33 Clément Sommelet
Hi, do you confirm that handcuffs are all opened at the beginning? Answer : No, all are locked first. Edited, Thanks. :) Last edit: 2010-11-12 02:08:18 |
|
2011-05-31 05:49:33 Lukmanul Hakim
Ok, edited... :D |
|
2011-05-31 05:49:33 :D
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. RE: THANKS! Last edit: 2010-11-11 16:06:41 |