{"trustable":false,"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":"MD","content":"\n\u003cdiv class\u003d\"panel_content\"\u003e\n Zero有一台老式打印机,有时候工作不太好。由于它是古董,他仍然喜欢用它来打印文章。但是它太旧了,不能长时间工作,肯定会磨损,所以Zero用一个成本来评估这个程度。\n \u003cbr\u003e\n 有一天,Zero想要打印一篇有$N$个字的文章,每个字i的打印成本是$C_i$。此外,Zero知道在一行中打印$k$个字将花费\n $$\\left(\\sum^k_{i\u003d1}C_i\\right)^2+M$$\n $M$是一个常数。\n \u003cbr\u003e\n 现在Zero想要知道安排文章完美地所需的最小成本。\n \u003cbr\u003e\n\u003c/div\u003e\n"}},{"title":"输入","value":{"format":"MD","content":"有很多测试用例。对于每个测试用例,第一行有两个数字N和M(0 ≤ n ≤ \u003cfont color\u003d\"red\"\u003e500000\u003c/font\u003e,0 ≤ M ≤ 1000)。然后,下面的第2到第N + 1行有N个数字。输入以EOF结束。"}},{"title":"输出","value":{"format":"MD","content":"一个数字,表示打印文章的最小成本。"}},{"title":"示例","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 5\n5\n9\n5\n7\n5\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e230\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}