每次选取堆里面最短的两根木头相加,再将所得和重新加入堆中,直到堆的size小于2View Code #include<queue>#include<stdio.h>#include<string.h>#include<vector>using namespace std;struct mycmp{ bool operator()(const int &a,const int &b) { return a>b; }};int main(){ priority_queue<__int64,vector<__int64 Read More