Untitled
unknown
plain_text
24 days ago
646 B
3
Indexable
Never
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; int main() { int t; cin >> t; while (t--) { int n; long long k; cin >> n >> k; vector<long long> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr.begin(), arr.end()); while (k--) { arr[0] *= 2; sort(arr.begin(), arr.end()); } long long sum = 0; for (int i = 0; i < n; i++) { sum = (sum + arr[i]) % MOD; } cout << sum << endl; } return 0; }
Leave a Comment