PAT7-05. 魔法优惠券
来源:互联网 发布:系统下载linux 编辑:程序博客网 时间:2024/04/20 01:31
#include<queue>#include<cstdio>#include<vector>using namespace std;priority_queue<int>a,c;// maximum heappriority_queue<int,vector<int>,greater<int> >b,d; // minimum heapint main(){ int n;scanf("%d",&n); while(n--){ int k;scanf("%d",&k); if(k>0)a.push(k); else b.push(k); } scanf("%d",&n); while(n--){ int k;scanf("%d",&k); if(k>0)c.push(k); else d.push(k); } int total(0); while(a.size()&&c.size()){ total+=a.top()*c.top(); a.pop();c.pop();} while(b.size()&&d.size()){ total+=b.top()*d.top(); b.pop();d.pop();} printf("%d",total); return 0;}
0 0
- PAT7-05. 魔法优惠券
- 魔法优惠券【模拟题】
- 5-39 魔法优惠券
- 浙大PAT 7-05. 魔法优惠券 (解题思路)
- 7-05. 魔法优惠券(25) (数学 ZJU_PAT)
- 5-39 魔法优惠券 (25分)
- 5-4 魔法优惠券 (25分)
- 5-39 魔法优惠券 (快排)
- 实验项目 7-05 魔法优惠券(25)
- PTA--魔法优惠券——stl快速排序
- 浙大 PTA 5-39 魔法优惠券 (25分)
- PAT7-06. 奥运排行榜
- PAT7-07. PAT排名汇总
- 魔法
- 魔法
- 微信摇一摇优惠券
- 自定义优惠券
- 自定义优惠券
- PAT8-06. 畅通工程之局部最小花费问题
- pcapReader——源码分析
- 自动化测试管理平台QTP based开发设计已完成(
- LeetCode 24. Reverse Nodes in k-Group
- [leetcode] Triangle
- PAT7-05. 魔法优惠券
- LeetCode 25. Remove Element
- LeetCode 26. Remove Duplicates from Sorted Array
- Hadoop MapReduce之ReduceTask任务执行(三):Merger线程分析
- LeetCode 27. Implement strStr() (KMP算法-模式串匹配)
- 虚拟键值表
- [leetcode] Unique Paths
- Android SQLite CHECK这个关键词始终不能用。
- Java设计模式之适配器模式(Adapter Pattern)