poj 2051 Argus
来源:互联网 发布:问东西的软件 编辑:程序博客网 时间:2024/05/21 22:25
set搞之……
/* * Author: stormdpzh * Created Time: 2012/7/22 23:35:15 * File Name: poj_2051.cpp */#include <iostream>#include <cstdio>#include <sstream>#include <cstring>#include <string>#include <cmath>#include <vector>#include <queue>#include <stack>#include <map>#include <set>#include <algorithm>#include <functional>#define sz(v) ((int)(v).size())#define rep(i, n) for(int i = 0; i < n; i++)#define repf(i, a, b) for(int i = a; i <= b; i++)#define repd(i, a, b) for(int i = a; i >= b; i--)#define out(n) printf("%d\n", n)#define mset(a, b) memset(a, b, sizeof(a))#define wh(n) while(1 == scanf("%d", &n))#define whz(n) while(1 == scanf("%d", &n) && n != 0)#define lint long longusing namespace std;const int MaxN = 1 << 30;struct Node { int ttime; int period; int id; Node(int _ttime, int _period, int _id) : ttime(_ttime), period(_period), id(_id) {} bool operator < (const Node &t) const { if(ttime == t.ttime) return id < t.id; return ttime < t.ttime; }};set<Node> st;char s[20];int id, period;int n;void gao(){ while(n--) { set<Node>::iterator it = st.begin(); printf("%d\n", it->id); st.insert(Node(it->ttime + it->period, it->period, it->id)); st.erase(it); }}int main(){ while(1 == scanf("%s", s)) { if(s[0] == '#') break; scanf("%d%d", &id, &period); st.insert(Node(period, period, id)); } scanf("%d", &n); gao(); return 0;}
- POJ 2051 Argus
- poj 2051 Argus
- poj 2051 Argus
- poj 2051 Argus
- POJ--2051--Argus
- poj 2051 - Argus(堆)
- POJ 2051 Argus
- POJ 2051 Argus
- POJ 2051 Argus
- Poj 2051 Argus
- Poj 2051 Argus
- POJ 2051 Argus
- poj-2051-Argus
- poj-2051-Argus
- POJ 2051 Argus
- zoj 2212 || poj 2051 Argus
- poj 2051 Argus(优先队列)
- zoj 2212 || poj 2051 Argus
- linux进程的休眠(等待队列)
- Linux进程的睡眠和唤醒简析
- 广州 Android 2011 3K
- hdu1542 面积交详细讲解
- C++Builder之Edit和Memo
- poj 2051 Argus
- hdu1542 Atlantis 面积交
- C#将exe运行程序嵌入到自己的winform窗体中
- 最长公共子串LCS--之动态规划
- 数据库连接池配置
- hdu 1255 覆盖的面积
- What I do
- css3之transform详解
- hdu 2795 Billboard 曾经无数次TLE