摘要: 优先队列与普通的队列相比好处就在于可以自定义优先级,优先级别高的先出队。下面附加代码介绍一下优先队列简单的自定义优先级别1。最大值优先出队View Code 1 #include <iostream> 2 #include <queue> 3 #include <algorithm> 4 5 using namespace std; 6 7 priority_queue<int>qu; 8 int main() 9 {10 int n,i,x;11 cin>>n;12 for(i = 0; i < n; i++)13 {14 c 阅读全文
posted @ 2012-05-11 20:35 AC_Girl 阅读(206) 评论(0) 推荐(0) 编辑
摘要: // 好几天请教的别人,当时是为了写算法作业,然后写完了就存优盘了,今天看见从新学习一下,好像还有一种方法就是运算符重载,不过没有试出来,等看了书再加上吧。// 之前不知道为什么写的折叠的代码打不开,又从新写了一遍#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#define N 1010using namespace std;class kuls{ public: struct node { int x,y,z; }eage[N]; /* 按权值从小 阅读全文
posted @ 2012-05-11 10:28 AC_Girl 阅读(217) 评论(0) 推荐(0) 编辑