UVALive 6530 Football (水
来源:互联网 发布:edf调度算法源代码 编辑:程序博客网 时间:2024/06/06 01:15
题目链接:点击打开链
#include <cstdio>#include <vector>#include <algorithm>using namespace std;typedef long long ll;vector<int> s;int main() {int n, k;while (~scanf("%d%d", &n, &k)) {s.clear();int sum = 0, cnt = 0;for(int i = 0, x, y; i < n; i ++) {scanf("%d%d", &x, &y);if(x > y) sum += 3;else if(x == y) {cnt ++;sum ++;} else s.push_back(y-x);}if(k >= cnt) {sum += 2*cnt;k -= cnt;} else {sum += 2*k;k = 0;}sort(s.begin(), s.end());for(int i = 0; i < s.size() && k > 0; i ++) {if(k > s[i]) {sum += 3;k -= s[i]+1;} else if(k == s[i]) {sum += 1;k -= s[i];}}printf("%d\n", sum);}return 0;}
0 0
- UVALive 6530 Football (水
- 【瞎搞】 UVALive 6530 Football
- 【贪心】UVALive 6530——Football
- UVALive-7601 Football(思维)
- LA 6530 Football 贪心
- Football
- Football
- Football
- Football
- Football
- Football
- 【水模拟】#77 A. Football
- Codeforces 493A. Vasya and Football 水
- Codeforces 493A Vasya and Football(水)
- CodeForces 96 A.Football(水~)
- UVALive 6181 Mystery (水
- UVALive 4723 水模拟
- UVALive 6833 (模拟 水~)
- 怎样利用Serv-U建立FTP站点
- 使用 Boost 的 IPC 和 MPI 库进行并发编程
- 更新客户配置文件
- 汽车百科系列之(一): 大话汽油
- Openwrt编译feeds机制
- UVALive 6530 Football (水
- POJ 1185 NOI 2001 炮兵阵地 状压DP
- 一张图看懂什么叫判断力
- 汽车百科系列之(二): 大话机油
- linux_C_environ变量
- Visual Studio2012 Lua插件--BabeLua
- jm8.6之参考帧管理
- 打印一个N*N的方阵,N为每边字符的个数( 3〈N〈20 ),写出来真是泪牛满面啊。
- 关于MappedByteBuffer使用后无法删除问题