{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003e考虑一个包括 2\u003csup\u003e\u003ci\u003en\u003c/i\u003e\u003c/sup\u003e 支球队的单淘汰足球锦标赛,球队编号为 1, 2, …, 2\u003csup\u003e\u003ci\u003en\u003c/i\u003e\u003c/sup\u003e。在锦标赛的每一轮中,仍在比赛中的所有球队按照索引递增的顺序排列在一张名单中。然后,名单中的第一支球队对阵第二支球队,第三支球队对阵第四支球队,以此类推。这些比赛的胜者晋级下一轮,而失败者被淘汰。经过 \u003ci\u003en\u003c/i\u003e 轮比赛后,只有一支球队保持不败;这支球队被宣布为冠军。\u003c/p\u003e\u003cp\u003e给定一个矩阵 \u003ci\u003eP\u003c/i\u003e \u003d [\u003ci\u003ep\u003csub\u003eij\u003c/sub\u003e\u003c/i\u003e],其中 \u003ci\u003ep\u003csub\u003eij\u003c/sub\u003e\u003c/i\u003e 表示球队 \u003ci\u003ei\u003c/i\u003e 在比赛中击败球队 \u003ci\u003ej\u003c/i\u003e 的概率,确定哪支球队最有可能赢得锦标赛。\u003c/p\u003e\u003c/span\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003e输入测试文件将包含多个测试用例。每个测试用例将以包含一个整数 \u003ci\u003en\u003c/i\u003e (1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 7) 的单行开头。接下来的 2\u003csup\u003e\u003ci\u003en\u003c/i\u003e\u003c/sup\u003e 行每行包含 2\u003csup\u003e\u003ci\u003en\u003c/i\u003e\u003c/sup\u003e 个值;这里,第 \u003ci\u003ei\u003c/i\u003e 行的第 \u003ci\u003ej\u003c/i\u003e 个值代表 \u003ci\u003ep\u003csub\u003eij\u003c/sub\u003e\u003c/i\u003e。矩阵 \u003ci\u003eP\u003c/i\u003e 将满足约束条件,即对于所有 \u003ci\u003ei\u003c/i\u003e ≠ \u003ci\u003ej\u003c/i\u003e,有 \u003ci\u003ep\u003csub\u003eij\u003c/sub\u003e\u003c/i\u003e \u003d 1.0 − \u003ci\u003ep\u003csub\u003eji\u003c/sub\u003e\u003c/i\u003e,对于所有 \u003ci\u003ei\u003c/i\u003e 有 \u003ci\u003ep\u003csub\u003eii\u003c/sub\u003e\u003c/i\u003e \u003d 0.0。文件结束由包含数字 -1 的单行表示。注意,本问题中的矩阵条目都以浮点数值给出。为避免精度问题,请确保使用 \u003ccode\u003edouble\u003c/code\u003e 数据类型而不是 \u003ccode\u003efloat\u003c/code\u003e。\u003c/p\u003e\u003c/span\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e输出文件应每个测试用例包含一行,指示最有可能赢得比赛的球队编号。为避免浮点精度问题,保证前两支球队获胜概率的差距至少为 0.01。\u003c/p\u003e"}},{"title":"样例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n0.0 0.1 0.2 0.3\r\n0.9 0.0 0.4 0.5\r\n0.8 0.6 0.0 0.6\r\n0.7 0.5 0.4 0.0\r\n-1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"提示","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003e在上述测试用例中,1 号和 2 号球队以及 3 号和 4 号球队在第一轮比赛中对阵;每场比赛的胜者随后进行比赛,以确定锦标赛的冠军。在这种情况下,2 号球队赢得锦标赛的概率为:\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd valign\u003d\"top\"\u003eP(2 wins)\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u003d \u003ci\u003eP\u003c/i\u003e(2 beats 1)\u003ci\u003eP\u003c/i\u003e(3 beats 4)\u003ci\u003eP\u003c/i\u003e(2 beats 3) + \u003ci\u003eP\u003c/i\u003e(2 beats 1)\u003ci\u003eP\u003c/i\u003e(4 beats 3)\u003ci\u003eP\u003c/i\u003e(2 beats 4)\u003cbr\u003e\u003d \u003ci\u003ep\u003c/i\u003e\u003csub\u003e21\u003c/sub\u003e\u003ci\u003ep\u003c/i\u003e\u003csub\u003e34\u003c/sub\u003e\u003ci\u003ep\u003c/i\u003e\u003csub\u003e23\u003c/sub\u003e + \u003ci\u003ep\u003c/i\u003e\u003csub\u003e21\u003c/sub\u003e\u003ci\u003ep\u003c/i\u003e\u003csub\u003e43\u003c/sub\u003e\u003ci\u003ep\u003c/i\u003e\u003csub\u003e24\u003c/sub\u003e\u003cbr\u003e\u003d 0.9 · 0.6 · 0.4 + 0.9 · 0.4 · 0.5 \u003d 0.396。\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003e下一个最有可能获胜的球队是 3 号球队,获胜概率为 0.372。\u003c/p\u003e\u003c/span\u003e"}}]}