{"trustable":true,"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e有$$$n$$$座方块塔,编号从$$$1$$$到$$$n$$$。第$$$i$$$座塔由$$$a_i$$$个方块组成。\u003c/p\u003e\u003cp\u003e每次移动,你可以把一个方块从第$$$i$$$座塔移动到第$$$j$$$座塔,但前提是$$$a_i \u0026gt; a_j$$$。这个移动会使$$$a_j$$$增加$$$1$$$,减少$$$a_i$$$个方块。你可以进行任意次数的移动(可能是零次)。\u003c/p\u003e\u003cp\u003e经过移动后,第$$$1$$$座塔上最多可以有多少个方块?\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$t$$$($$$1 \\le t \\le 10^4$$$)— 测试用例的数量。\u003c/p\u003e\u003cp\u003e每个测试用例的第一行包含一个整数$$$n$$$($$$2 \\le n \\le 2 \\cdot 10^5$$$)— 塔的数量。\u003c/p\u003e\u003cp\u003e第二行包含$$$n$$$个整数$$$a_1, a_2, \\dots, a_n$$$($$$1 \\le a_i \\le 10^9$$$)— 每座塔上的方块数量。\u003c/p\u003e\u003cp\u003e所有测试用例中$$$n$$$的总和不超过$$$2 \\cdot 10^5$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,打印出经过任意次数移动后第$$$1$$$座塔上最多可以有多少个方块。\u003c/p\u003e"}},{"title":"示例 1","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\u003e4\n3\n1 2 3\n3\n1 2 2\n2\n1 1000000000\n10\n3 8 6 7 4 1 2 4 10 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n2\n500000001\n9\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个测试用例中,你可以把一个方块从第$$$2$$$座塔移动到第$$$1$$$座塔,使方块数量变为$$$[2, 1, 3]$$$。然后再把一个方块从第$$$3$$$座塔移动到第$$$1$$$座塔,使方块数量变为$$$[3, 1, 2]$$$。第$$$1$$$座塔有$$$3$$$个方块,无法获得更多。\u003c/p\u003e\u003cp\u003e在第二个测试用例中,你可以把任意一座塔的方块移动到第$$$1$$$座塔,使其有$$$2$$$个方块。\u003c/p\u003e\u003cp\u003e在第三个测试用例中,你可以$$$500000000$$$次把一个方块从第$$$2$$$座塔移动到第$$$1$$$座塔。之后方块数量将变为$$$[500000001, 500000000]$$$。\u003c/p\u003e"}}]}