第十五届蓝桥杯:爬山
- 人工智能
- 2025-08-21 20:15:02

考察范围:贪心+优先级队列
#include <iostream> #include <queue> #include <cmath> using namespace std; priority_queue <int> heap; int n,p,q; int tmp; int main() { cin >> n >> p >> q; while(n--) { cin >> tmp; heap.push(tmp); } while(p--) { int t = heap.top(); heap.pop(); heap.push(sqrt(t)); } while(q--) { int t2 = heap.top(); heap.pop(); heap.push(t2/2); } int sum = 0; while(heap.size() != 0) { int t3 = heap.top(); sum+=t3; heap.pop(); } cout << sum << endl; return 0; }第十五届蓝桥杯:爬山由讯客互联人工智能栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“第十五届蓝桥杯:爬山”