UVALive
来源:互联网 发布:北大光华mba知乎 编辑:程序博客网 时间:2024/06/16 01:34
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <queue>using namespace std;struct Date { int val, id, add; Date(int x, int y, int z) : val(x), id(y), add(z) {} bool operator < (const Date &temp) const { if (val != temp.val) return val > temp.val; return id > temp.id; }};int main() { priority_queue<Date> q; char str[20]; while (~scanf("%s", str) && str[0] != '#') { int a, b; scanf("%d %d", &a, &b); q.push(Date(b, a, b)); } int k; scanf("%d", &k); for (int i = 1; i <= k; i++) { Date ans = q.top(); q.pop(); printf("%d\n", ans.id); ans.val += ans.add; q.push(ans); }}
阅读全文
0 0
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- Failed to resolve: com.facebook.fresco:fresco:0.6.0
- 备忘--python常见面试题
- Zabbix中文乱码的解决方法
- spring+mybatis报错:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating
- C语言字符串处理的一些函数strok,strstr, strchr,strsub
- UVALive
- Java WebService 简单实例(有图)
- 【PHP】使用MySQLi方式连接数据库,增删改查
- CEOI2017 day1-Sure Bet【三分】
- leetcode Reverse String II 反转字符串
- F:\workspace-maven\e3-manager\e3-manager-interface\target\classes\META-INF\MANIFEST.MF (系统找不到指定的路径。)
- EsLint入门
- ubuntu如何安装libz库
- 线程同步辅助类(一)