输入样例:
8
4 5 1 2 1 3 1 1
输出样例:
49
虽说这道题贴上了树的标签,但我好像没有用到树的知识hh
stl大法好
#include<bits/stdc++.h>
using namespace std;
int n;
int a[10001];
priority_queue <int,vector<int>,greater<int
本文解析了一道PTA竞赛题目,通过使用STL中的优先队列实现了一个算法,该算法可以有效地解决输入样例中给出的问题。代码示例清晰地展示了如何初始化变量、读取输入并逐步解决问题直到得到最终答案。
输入样例:
8
4 5 1 2 1 3 1 1
输出样例:
49
虽说这道题贴上了树的标签,但我好像没有用到树的知识hh
stl大法好
#include<bits/stdc++.h>
using namespace std;
int n;
int a[10001];
priority_queue <int,vector<int>,greater<int
803
342
2877

被折叠的 条评论
为什么被折叠?