{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"邪恶的 cocktail 为了练成巫术,绑架了 `n` 个人,并且要求它们围成一圈,分别编号为 `1,2,3,...,n`。它们按照如下规则:\n\n以顺时针顺序,第一个人开始报数 `1`,第二个人报数 `2`,……,当报到 `k` 时,这个人出列被烧死。接下来,这个人后面的那个人从 `1` 开始报数,如此循环下去,直到一个人都不剩。\n\ncocktail 想知道,在最开始的编号中,第 `m` 个被烧死的人的编号是多少?"}},{"title":"输入","value":{"format":"MD","content":"输入包含多组测试样例,第一行包含数字 `T` 表示测试样例数量,并且测试样例数量不超过 1000。\n\n对于每个测试样例,一行数字 `n, m, k`,其中 1 ≤ n, m, k ≤ 10\u003csup\u003e18\u003c/sup\u003e, n ≥ m。\n\n我们保证所有测试样例的 `min{m,k}` 总和不超过 2 × 10\u003csup\u003e6\u003c/sup\u003e。"}},{"title":"输出","value":{"format":"MD","content":"对于每个测试样例,输出一行 `Case #x: y`,其中 `y` 为cocktail想知道的那个编号。"}},{"title":"样例输入","value":{"format":"MD","content":"```\n20\n10 1 2\n10 2 2\n10 3 2\n10 4 2\n10 5 2\n10 6 2\n10 7 2\n10 8 2\n10 9 2\n10 10 2\n10 1 3\n10 2 3\n10 3 3\n10 4 3\n10 5 3\n10 6 3\n10 7 3\n10 8 3\n10 9 3\n10 10 3\n```"}},{"title":"样例输出","value":{"format":"MD","content":"```\nCase #1: 2\nCase #2: 4\nCase #3: 6\nCase #4: 8\nCase #5: 10\nCase #6: 3\nCase #7: 7\nCase #8: 1\nCase #9: 9\nCase #10: 5\nCase #11: 3\nCase #12: 6\nCase #13: 9\nCase #14: 2\nCase #15: 7\nCase #16: 1\nCase #17: 8\nCase #18: 5\nCase #19: 10\nCase #20: 4\n```"}},{"title":"提示","value":{"format":"MD","content":"样例给出了当 `(n,k)` 分别为 `(10,2)` 和 `(10,3)` 的情况。"}}]}