Initial commit

This commit is contained in:
2025-03-14 22:39:32 +08:00
commit 7b1e0f329e
38 changed files with 1153 additions and 0 deletions

26
15lanqiao/test7.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int main(){
priority_queue<int> pq; // 大根堆
int n, p ,q; cin >> n >> p >> q;
for(int i = 1; i <= n; i++){
int x; cin >> x;
pq.push(x);
}
while(p || q){
int cur = pq.top(); // 最大值
pq.pop();
if(p){ cur = sqrt(cur); p--; }
else if(q) { cur = cur / 2; q--; }
pq.push(cur);
}
int s = 0; // 总的消耗
while(!pq.empty()) { s += pq.top(); pq.pop(); }
cout << s << endl;
return 0;
}
/* test samples
4 1 1
4 5 6 49
*/