AcWing 913. 排队打水
作者:互联网
#include <iostream> #include <algorithm> using namespace std; typedef long long LL; const int N = 100010; int n; int t[N]; int main() { scanf("%d", &n); for (int i = 0; i < n; i ++ ) scanf("%d", &t[i]); sort(t, t + n); reverse(t, t + n); LL res = 0; for (int i = 0; i < n; i ++ ) res += t[i] * i; printf("%lld\n", res); return 0; }
标签:int,res,LL,排队,long,++,include,913,AcWing 来源: https://www.cnblogs.com/QingyuYYYYY/p/11914370.html