找出最大的20个数
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <hash_set>
#include <ctime>
using namespace std;
int main(){
//freopen("C:\\in.txt","r",stdin);
vector<int> t(50);
iota(t.begin(),t.end(),1);
random_shuffle(t.begin(),t.end());
for_each(t.begin(),t.end(),[](int i){cout<<i<<endl;});
cout<<endl;
make_heap(t.begin(),t.begin()+21,greater<int>());
for(auto it=t.begin()+21;it!=t.end();){
push_heap(t.begin(),t.begin()+21,greater<int>());
pop_heap(t.begin(),t.begin()+21,greater<int>());
it=t.erase(t.begin()+20);
}
sort(t.begin(),t.end(),greater<int>());
for_each(t.begin(),t.end(),[](int i){cout<<i<<endl;});
return 0;
}