{"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":"\u003cdiv class\u003d\"panel_content\"\u003e 诸如《非诚勿扰》这样的电视节目一直很受欢迎。为了满足仍然单身的男孩们的需求,TJUT举办了这个节目。这个节目在小礼堂举行,所以吸引了很多男孩和女孩。现在有n个男孩报名参加。一开始,这n个男孩站成一排,依次上台。然而,导演突然得知,每个男孩都有一个屌丝值D,如果第k个上台的男孩,他的不快乐值将会是(k-1)*D,因为他必须等待(k-1)个人。幸运的是,小礼堂里有一个黑暗的房间,所以导演可以暂时把男孩放进黑暗的房间,让他后面的男孩先上台。由于黑暗房间很窄,第一个进入黑暗房间的男孩必须最后离开。导演希望通过黑暗房间改变男孩们的顺序,使得不快乐值的总和最小。你能帮他吗?\u003cbr\u003e\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":" 第一行包含一个整数T,表示测试用例的数量。对于每个测试用例,第一行是n (0 \u003c n \u003c\u003d 100)\u003cbr\u003e 接下来的n行是n个整数D1-Dn,表示男孩们的屌丝值 (0 \u003c\u003d Di \u003c\u003d 100)\u003cbr\u003e"}},{"title":"输出","value":{"format":"HTML","content":" 对于每个测试用例,输出不快乐值的总和的最小值。\u003cbr\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\n \r\n5\r\n1\r\n2\r\n3\r\n4\r\n5\r\n\r\n5\r\n5\r\n4\r\n3\r\n2\r\n2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 20\r\nCase #2: 24\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}