{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\n\u003cdiv class\u003d\"panel_content\"\u003e\n一起发生了一起酒店内的谋杀案。作为镇上最好的侦探,你应该立即检查酒店的所有N个房间。然而,所有房间的门都被锁上了,而钥匙就在房间里,真是个陷阱!你知道每个房间里恰好有一把钥匙,而所有可能的分配都是等可能的。例如,如果N \u003d 3,则有6种可能的分配,每种可能性的概率都是1/6。为了方便起见,我们将房间从1到N编号,房间1的钥匙编号为钥匙1,房间2的钥匙编号为钥匙2,依此类推。\n\u003cbr\u003e\n为了检查所有房间,你必须强行破坏一些门。但你不想破坏太多,所以你采取以下策略:一开始,你手里没有钥匙,所以你随机破坏一扇锁着的门,进入房间,检查它并取出其中的钥匙。然后,也许你可以用新钥匙打开另一个房间,检查它并取得第二把钥匙。重复此过程,直到你无法打开任何新房间。如果仍有未检查的房间,则必须随机选择另一扇未打开的门进行强制破坏,然后重复上述过程,直到检查完所有房间。\n\u003cbr\u003e\n现在你只能强行破坏至多K扇门。而且,房间1里住着一个非常重要的人。你不允许破坏房间1的门,也就是说,检查房间1的唯一方法是用相应的钥匙打开它。你想知道最终能够检查所有房间的可能性是多少。\n\u003c/div\u003e\n"}},{"title":"输入格式","value":{"format":"HTML","content":"第一行包含一个整数T(T≤200),表示测试用例的数量。然后是T个测试用例。每个测试用例包含一行,其中包含两个数字N和K。(1<N≤20,1≤K<N)"}},{"title":"输出格式","value":{"format":"HTML","content":"对于每个测试用例输出一行,表示相应的可能性。四舍五入保留小数点后四位。"}},{"title":"样例","value":{"format":"HTML","content":"输入样例:\n1\n3 2\n输出样例:\n0.3333"}},{"title":"提示","value":{"format":"HTML","content":"\u003cbr\u003e\n样例解释\n\u003cbr\u003e\n\u003cbr\u003e\n当N \u003d 3时,有6种可能的钥匙分配:\n\u003cbr\u003e\n\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;房间1\u0026nbsp;\u0026nbsp;房间2\u0026nbsp;\u0026nbsp;房间3\u0026nbsp;\u0026nbsp;破坏次数\n\u003cbr\u003e\n#1\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;不可能\n\u003cbr\u003e\n#2\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;不可能\n\u003cbr\u003e\n#3\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;两次\n\u003cbr\u003e\n#4\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;两次\n\u003cbr\u003e\n#5\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;一次\n\u003cbr\u003e\n#6\u0026nbsp;\u0026nbsp;钥匙3\u0026nbsp;\u0026nbsp;钥匙1\u0026nbsp;\u0026nbsp;钥匙2\u0026nbsp;\u0026nbsp;一次\n\u003cbr\u003e\n\u003cbr\u003e\n在前两种分配中,因为钥匙1被锁在房间1本身中,你无法破坏房间1,因此无法打开房间1。\n\u003cbr\u003e\n在第三和第四种分配中,你必须同时破坏房间2和3。在最后两种分配中,你只需要破坏房间2或房间3中的一个。"}}]}