标签:c style class blog code java
注意数据范围即可
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ long long n,x; cin >> n >> x; vector<long long> c(n); for(int i = 0 ; i < n; ++ i) cin >> c[i]; sort(c.begin(),c.end()); long long res = 0; for(int i = 0 ; i < n; ++ i){ res +=c[i]*(x> 1 ? x--: 1); } cout<<res<<endl; }
Codeforces Round #251 (Div. 2) B. Devu, the Dumb Guy,布布扣,bubuko.com
Codeforces Round #251 (Div. 2) B. Devu, the Dumb Guy
标签:c style class blog code java
原文地址:http://www.cnblogs.com/xiongqiangcs/p/3776961.html