HDU 1896 Stones(优先队列)
来源:互联网 发布:suse linux 12 iso 编辑:程序博客网 时间:2024/05/18 03:21
简单模拟即可。
#include <queue>#include <cstdio>using namespace std;struct node{ int pos,dis; bool operator <(const node t)const { if(pos!=t.pos) return pos>t.pos; return dis>t.dis; }};int main(){ priority_queue<node>q; int T,n; node t; scanf("%d",&T); while(T--) { scanf("%d",&n); while(n--) { scanf("%d%d",&t.pos,&t.dis); q.push(t); } bool flag=true; while(!q.empty()) { t=q.top(); q.pop(); if(flag) { flag=false; t.pos+=t.dis; q.push(t); } else flag=true; } printf("%d\n",t.pos); } return 0;}
- HDU 1896 Stones(优先队列)
- hdu 1896 Stones 优先队列
- hdu 1896 Stones(优先队列)
- HDU 1896 Stones (优先队列)
- HDU 1896 Stones 【优先队列】
- HDU 1896 Stones(优先队列)
- HDU 1896 Stones 优先队列
- HDU 1896 Stones 优先队列
- HDU 1896 Stones --优先队列+搜索
- HDU 1896 -- Stones (优先队列)
- hdu 杭电1896 Stones【优先队列】
- HDU 1896 Stones(优先队列)
- 【HDU]-1896-Stones(优先队列,好)
- HDU:1896 Stones(优先队列)
- HDU 1896 Stones (优先队列)
- hdu 1896 Stones(优先队列 Dijkstr)
- hdu--1896Stones(优先队列)
- HDU 1896:Stones(优先队列)
- centos中wget的使用方法
- myeclipse的优化
- JS中批量给元素绑定事件过程使用闭包解决
- 工作笔记二
- 如何在右键中增加菜单
- HDU 1896 Stones(优先队列)
- 大话设计模式总结1----全书概览
- 整理JavaScript的Call和Apply区别
- Joomla的module_plugin_component开发环境及流程
- 专题4-5指针数组和数组指针分析(国嵌C语言视频)
- find_first_of
- js中的总结
- 一些PHP性能优化
- 黑洞数