시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 256 MB766100.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.

  • 0 < T ≤ 30
  • 2 ≤ N ≤ 10000000
  • 2 ≤ k ≤ N

출력

For each test case, output the probability with an accuracy of at least 10−6.

예제 입력 1

4
2 2
3 2
3 3
10 3

예제 출력 1

1.000000000
0.750000000
0.250000000
0.313469843