#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; }

相关推荐

点赞 评论 收藏
分享
白火同学:能。我当初应届沟通了1200,收简历50,面试10左右吧,加油投吧
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务