hdu 1509 优先队列
2011-11-08 22:03
344 查看
View Code
#include<stdio.h> #include<string.h> #include<queue> using namespace std; struct node{ char s[20]; int canshu; int priority; int num; bool operator < (const node&b) const{ if(priority==b.priority) return num>b.num; return priority>b.priority; } }; int main() { int i,j,t; char str[20]; priority_queue<node>Q; // scanf("%d",&t); int tot=0; while(scanf("%s",str)!=EOF) { if(strcmp(str,"GET")==0) { if(!Q.empty()) {printf("%s %d\n",Q.top().s,Q.top().canshu); Q.pop();} else printf("EMPTY QUEUE!\n"); } else { node tmp; scanf("%s%d%d",tmp.s,&tmp.canshu,&tmp.priority); tmp.num=++tot; Q.push(tmp); } } return 0; }
相关文章推荐
- HDU-1509-Windows Message Queue(优先队列)
- hdu 1509 Windows Message Queue (简单STL的优先队列应用)
- hdu 1509 1873()病人要看病 优先队列(符号重载)
- hdu-1509 Windows Message Queue(优先队列)
- HDU 1509 Windows Message Queue (优先队列)
- hdu 1509 Windows Message Queue(优先队列)
- HDU 1509 -- Windows Message Queue(优先队列)
- hdu 1509 Windows Message Queue (优先队列)
- hdu 1509 Windows Message Queue (优先队列)
- hdu 1509 Windows Message Queue(优先队列)
- HDU 1509 Windows Message Queue(优先队列)
- hdu 1509 Windows Message Queue 优先队列
- HDU 1509 Windows Message Queue(优先队列)
- HDU 1509 Windows Message Queue(优先队列)
- ZOJ 2724/HDU 1509 Windows Message Queue(优先队列)
- HDU 1509 Windows Message Queue(优先队列)
- hdu - 4302 Holedox Eating (优先队列)
- hdu 1509 Windows Message Queue
- hdu 5437 Alisha’s Party (优先队列)
- hdu 1548 A strange lift(优先队列)