题解 2059: [STL训练]sort练习

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

最简单的方法

摘要:解题思路:运用sort函数注意事项:sort函数是由小到大排序 逆序输出排序后的m个数组元素即可参考代码:#include<bits/stdc++.h>#define int long l……

这个够简短了吧

摘要:解题思路:利用方向输出来从大到小输出注意事项:参考代码:#include<iostream>#include<algorithm>#include<vector>u……

优先队列的使用

摘要:#include<bits/stdc++.h> using namespace std; priority_queue<int>v;//大根堆 int main() {     int n,……

2059: [STL训练]sort练习

摘要:解题思路:注意事项:参考代码:sort排序从后向前输出#include<bits/stdc++.h> int main() {     int m,n;     int arr[1000]; ……

[STL训练]sort练习

摘要:```cpp #include using namespace std; #include int main(){ int n,m; cin >> n >> m; list l……

2059: [STL训练]sort练习

摘要:#include <bits/stdc++.h> using namespace std; bool cmp(int &a,int &b){     return a>b; } in……

思路简单,清晰明了

摘要:#这题目 我直接反手一个sort()排序 ###一开始把数组设置了a[1000],没想到过了。我怕出问题,然后我直接弄到了a[1000000],还行也过了,就是内存大点。 ``` #includ……