poj 3614 Sunscreen
来源:互联网 发布:圆形水池计算软件 编辑:程序博客网 时间:2024/05/19 09:16
贪心。
/*Poj: 3614 Sunscreen*/#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#define MaxLC 2505using namespace std;struct Cow { int minn, maxx; bool operator < (const struct Cow & t) const { return maxx < t.maxx; }}cow[MaxLC];struct SPF { int spf; int total; bool operator < (const struct SPF &t) const { if(spf < t.spf) return true; else return false; }}lotion[MaxLC];int c, l;int res;int main(){ //freopen("data.in", "rb", stdin); while(scanf("%d%d", &c, &l) != EOF) { for(int i = 0; i < c; i++) { scanf("%d%d", &cow[i].minn, &cow[i].maxx); } for(int i = 0; i < l; i++) { scanf("%d%d", &lotion[i].spf, &lotion[i].total); } sort(cow, cow + c); sort(lotion, lotion + l); res = 0; for(int i = 0; i < c; i++) { for(int j = 0; j < l; j++) { if(lotion[j].spf >= cow[i].minn && lotion[j].spf <= cow[i].maxx && lotion[j].total > 0) { res++; lotion[j].total--; break; } if(lotion[j].spf > cow[i].maxx) break; } } printf("%d\n", res); } return 0;}
- poj 3614 Sunscreen
- poj 3614 Sunscreen 贪心
- poj 3614 Sunscreen (贪心)
- POJ-3614-Sunscreen
- POJ 3614 Sunscreen
- poj-3614-Sunscreen
- poj 3614 Sunscreen 贪心
- POJ-3614 sunscreen
- POJ 3614 Sunscreen
- poj --3614 Sunscreen
- ***POJ 3614 Sunscreen
- POJ 3614 Sunscreen 优先队列
- POJ 3614 Sunscreen 优先队列
- POJ 3614 Sunscreen(贪心)
- POJ 3614 Sunscreen 优先队列
- poj 3614 Sunscreen(priority_queue && Greedy)
- POJ 3614 Sunscreen 优先队列
- Sunscreen POJ
- 随笔-能够让我们感觉美好的只是回忆而已
- 0/1背包问题
- poj 3620 Avoid The Lakes
- linux块设备6
- 13.2
- poj 3614 Sunscreen
- 安意如美丽的句子
- 线程池ThreadPoolExecutor参数设置
- Posix线程编程指南(1)
- OpenCV-我的开始
- WIN7 X64 GDAL GEOS 编译
- 基于Windows8与Visual Studio11开发第一个内核驱动程序
- Delphi写的多媒播放器
- poj 3615 Cow Hurdles