不会使用优先级队列,大佬帮忙看看是什么问题
查看原帖
不会使用优先级队列,大佬帮忙看看是什么问题
560291
the_Dream_Chaser楼主2024/4/25 17:25
#include<bits/stdc++.h>
using namespace std;
struct st{
	int a;
	int b;
};
st s; 
priority_queue<st,vector<st> ,less<st> > q;
int main(){
	for(int i=1;i<=5;i++){
		s.a=i*i;
		s.b=i*2;
		q.push(s);
	}
	
	
	while(!q.empty()){
		st x=q.top();
		cout << x.a <<" " << x.b << endl;
		q.pop();
	}
}
2024/4/25 17:25
加载中...