#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 5; int a[N], n, q, x; int main() { cin >> n; unordered_map<ll, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } cin >> q; ll cur = 0; while (q--) { cin >> x; cur += x; ll res = 0; for (auto&; kv: mp) { res += abs(kv.first + cur) * kv.second; } cout << res << endl; } return 0; }

相关推荐

点赞 评论 收藏
分享
gelmanspar...:奖学金删掉,自我评价删掉,简历压缩一下,写一页
如果再来一次,你还会学机...
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
10-29 21:14
疯犬丨哈士奇:喜欢你的人会主动表白,对你有想法的人会很主动,所以要你的公司不会吊着你所以懂了吧
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务