UVALive
来源:互联网 发布:化妆基础知乎 编辑:程序博客网 时间:2024/06/05 02:58
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1136
优先队列,设定一下优先级就好!
#include<iostream>#include<queue>#include<stdio.h>using namespace std;struct Argus{ int q,p,s; bool operator<(const Argus&A)const { return A.s<s||(A.s==s&&A.q<q); }};int main(){ int n; char s[10]; Argus a; priority_queue<Argus> que; while(scanf("%s",s)!=EOF) { if(s[0]=='#') break; scanf("%d%d",&a.q,&a.p); a.s=a.p; que.push(a); } scanf("%d",&n); while(n--) { a=que.top(); printf("%d\n",a.q); que.pop(); a.s+=a.p; que.push(a); }}
阅读全文
0 0
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- blast2go本地安装,一个防火墙设置引发的血案
- Mysql索引及优化
- SpringBoot+Ajax文件上传+FormData表单提交
- 一个网络库的实现
- Python的类的继承的C3算法的序列
- UVALive
- 深入理解链式前向星
- [PAT乙级]1021. 个位数统计 (15)
- HihoCoder
- python多线程threading及锁机制
- Intellij IDEA 没办法创建java文件
- 【HDU】6053
- myeclipse搭建maven web工程
- PYTHON 一些基础面试题目总结