哒哒哒哒 一些有趣的东西 HihoCoder 1082 &&CUGOJ 1569
来源:互联网 发布:nginx生成ssl证书 编辑:程序博客网 时间:2024/05/01 17:31
沼泽鱼已经看穿了一切hhhhh
STL大法好
下面是一个优先级队列使用的例子,反正自己看的,随便
#include<iostream>#include<vector>#include<algorithm>#include<cmath>#include<string>#include<list>#include<stdlib.h>using namespace std;int main() {string s;while (getline(cin,s)) {string temp=s;for (int i = 0; i < s.size(); i++) {if (s[i] >= 'A'&&s[i] <= 'Z')s[i] += 32;}int flag = s.find("marshtomp");while (flag != s.npos) {s.erase(flag, 9);s.insert(flag, "fjxmlhx");temp.erase(flag, 9);temp.insert(flag, "fjxmlhx");flag = s.find("marshtomp");}cout << temp << endl;}return 0;}
#include<iostream>#include<algorithm>#include<string>#include<queue>#include<cmath>#include<vector>#include<stdlib.h>#include<iomanip>#include<map>#include<stack>#include<memory.h>using namespace std;typedef long long ll;struct paticent{int id;int doctor;int ill;};struct cmp {bool operator ()(paticent &a, paticent &b) {if (a.ill != b.ill) {return a.ill < b.ill;}else return a.id > b.id;}};int main() {priority_queue<paticent, vector<paticent>, cmp> que1;priority_queue<paticent, vector<paticent>, cmp> que2;priority_queue<paticent, vector<paticent>, cmp> que3;paticent pe;string s; int a, b;int t;while (scanf("%d", &t) != -1) {while (!que1.empty()) { que1.pop(); }while (!que2.empty()) { que2.pop(); }while (!que3.empty()) { que3.pop(); }int flag(0);for (int i = 0; i < t; i++) {cin >> s;if (s == "IN") {cin >> a >> b;flag++;pe.id = flag;pe.doctor = a;pe.ill = b;if (a == 1)que1.push(pe);else if (a == 2)que2.push(pe);else que3.push(pe);}if (s == "OUT") {cin >> a;if (a == 1) {if (!que1.empty()) {cout << que1.top().id << endl;que1.pop();}else cout << "EMPTY" << endl;}else if (a == 2) {if (!que2.empty()) {cout << que2.top().id << endl;que2.pop();}else cout << "EMPTY" << endl;}else if (a == 3) {if (!que3.empty()) {cout << que3.top().id << endl;que3.pop();}else cout << "EMPTY" << endl;}}}}return 0; }
阅读全文
0 0
- 哒哒哒哒 一些有趣的东西 HihoCoder 1082 &&CUGOJ 1569
- 哒哒哒哒
- dss湿哒哒实打实的
- 哒哒狗
- 一些有趣的东西
- 哒哒租车系统(慕课网学习)
- 假期穿上这款超轻亲子鞋,蹦蹦哒哒合家欢丨钛空舱
- C# 4.0一些有趣的东西
- Javascript有趣的东西
- 有趣的地方,有趣的东西!
- 发现个有趣的东西
- 一些有趣的名字
- 一些有趣的forum
- 一些有趣的题目
- 一些有趣的问题
- 一些有趣的文章
- 有趣的一些智力题
- 一些有趣的blog
- If-else 语句 和 三元运算符
- 郑州集训day2下午:搜索基础
- fatal error LNK1104: 无法打开文件“opencv_core2413.dll”
- Ubuntu 安装pangolin
- some useful stuff about TCP/IP
- 哒哒哒哒 一些有趣的东西 HihoCoder 1082 &&CUGOJ 1569
- If..else If…else 语句 与 switch 语句的不同之处.
- 暑假总结(四)
- 显著性检测(三)A Model of Saliency-Based Visual Attention for Rapid Scene Analysis
- If(flag) 与 if(!flag)
- STM32的中断和事件(很好此作者嵌入式学习有见地)20171004
- 暑假总结(五)
- 求解强连通分量的Tarjan算法描述
- 暑假总结(六)