시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 256 MB | 7 | 6 | 6 | 100.000% |
N persons have been invited to a somewhat special birthday party. Each person brings one present, but the recipent of each present is determined randomly. A person never receives his own present, but all other persons are equally likely recipients. What is the probability that one can find k persons at the party such that person 1 gives his present to person 2, person 2 gives his present to person 3 and so on to person k which gives his present to person 1?
The first line of the input consists of a single integer T, the number of test cases. Each test case consists of two integers N and k.
For each test case, output the probability with an accuracy of at least 10−6.
4 2 2 3 2 3 3 10 3
1.000000000 0.750000000 0.250000000 0.313469843
Contest > IDI Open Contest > IDI Open 2012 G번