{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027],[\u0027\\[\u0027,\u0027\\]\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027description-container\u0027]);}, 2000);\u003c/script\u003e\n在学校食堂的旁边有一个水房,每天都有人来打热水\u003cbr\u003e\n在东北没热水过不下去啊 嘤嘤嘤嘤 ~~ \u003cbr\u003e\n上次你们美丽的许姐姐 给你们出了个打水的题目吧\u003cbr\u003e\n现在她又出了一个给你们写不要辜负她哦嘿嘿嘿嘿\u003cbr\u003e\nn个人一起排队接水,第i个人需要b[i]的时间来接水。\n\u003cdiv\u003e\n 1 \u0026lt;\u003d n \u0026lt;\u003d 1000\n\u003c/div\u003e\n\u003cdiv\u003e\n 0 \u0026lt;\u003d b[i] \u0026lt;\u003d 1000\n \u003cbr\u003e\n \u003cdiv\u003e\n 同时只能有一个人接水,正在接水的人和没有接水的人都需要等待。\n \u003c/div\u003e\n \u003cdiv\u003e\n 完成接水的人会立刻消失,不会继续等待。\n \u003c/div\u003e\n \u003cdiv\u003e\n 你可以决定所有人接水的顺序,并希望最小化所有人等待时间的总和。\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"第一行一个整数n\n\u003cbr\u003e接下来n行,每行一个整数表示b[i]"}},{"title":"Output","value":{"format":"HTML","content":"一行一个整数,表示所有人等待时间的总和的最小值"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3\n1\n2\n3\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e10\u003c/pre\u003e"}}]}