- 浏览: 36635 次
- 性别:
- 来自: 杭州
最新评论
Sample Input:
4 1 2 4 -1 4 7 6 -2 -3Sample Output:
43
#include <iostream> #include <string.h> #include <vector> #include <algorithm> #include <functional> using namespace std; int main() { int total = 0; int NC,NP; vector<int> VC1,VC2; cin>>NC; for (int i = 0; i < NC; i++) { int x; cin>>x; if (x > 0) { VC1.push_back(x); } else { VC2.push_back(x); } } sort(VC1.begin(),VC1.end(),greater<int>()); sort(VC2.begin(),VC2.end(),less<int>()); vector<int> VP1,VP2; cin>>NP; for (int i = 0; i < NP; i++) { int x; cin>>x; if (x > 0) { VP1.push_back(x); } else { VP2.push_back(x); } } sort(VP1.begin(),VP1.end(),greater<int>()); sort(VP2.begin(),VP2.end(),less<int>()); int N1 = min(VC1.size(),VP1.size()); for (int i = 0; i < N1; i++) { total += VC1[i]*VP1[i]; } int N2 = min(VC2.size(),VP2.size()); for (int i = 0; i < N2; i++) { total += VC2[i]*VP2[i]; } printf("%d",total); return 0; }
发表评论
-
PAT1013 Battle Over Cities
2012-11-29 23:59 773Sample Input 3 2 3 1 2 1 3 ... -
PAT1003 Emergency
2012-11-29 23:46 661Sample Input 5 6 0 2 1 2 1 ... -
PAT1041 Be Unique
2012-11-23 23:43 759找出只出现过一次的数,用各种排序必然超时,需要用数组做hash ... -
PAT1042 Shuffling Machine
2012-11-23 23:42 733扑克洗牌 #include < ... -
PAT1040 Longest Symmetric String
2012-11-23 23:41 959求最长回文子串 #include < ... -
PAT1036 Boys vs Girls
2012-11-23 23:41 716Sample Input 1: 3 Joe M Mat ... -
PAT1035 Password
2012-11-23 23:40 616Sample Input 1: 3 Team0000 ... -
PAT1031 Hello World for U
2012-11-22 23:54 654Sample Input: helloworld! S ... -
PAT1029 Median
2012-11-22 23:54 651用标准库的排序全部超时,需要自己实现,另外还不能用cin co ... -
PAT1028 List Sorting
2012-11-22 23:53 807用vector最后一个用例超时了。。。 Sample ... -
PAT1027 Colors in Mars
2012-11-22 23:52 623Sample Input 15 43 71 Samp ... -
PAT1025 PAT Ranking
2012-11-22 23:51 771Sample Input: 2 5 123456789 ... -
PAT1023 Have Fun with Numbers
2012-11-21 23:55 687大数的相加 比较两个字符串中字符完全相同 Sa ... -
PAT1020 Tree Traversals
2012-11-21 23:54 652已知中序遍历 后序遍历,求层次遍历 Sample In ... -
PAT1019 General Palindromic Number
2012-11-21 23:53 537十进制转任意进制,并比较是否是回文数 Sample I ... -
PAT1038 Recover the Smallest Number
2012-11-20 23:52 1668由一道面试题改的 把数组排成最小的数 不同之处是这 ... -
PAT1024 Palindromic Number
2012-11-20 23:51 647Sample Input 1: 67 3 Sampl ... -
PAT1015 Reversible Primes
2012-11-19 23:51 771十进制转任意进制 假设十进制数为number,转 ... -
PAT1012 The Best Rank
2012-11-19 23:50 926四门功课,输出排名最高的是哪个 Sample Inpu ... -
PAT1011 World Cup Betting
2012-11-19 23:50 534Sample Input 1.1 2.5 1.7 1.2 ...
相关推荐
Clipper theme is a new premium wordpress coupon theme from Appthemes. Coupon collecting and using is becoming big business. With new sites like Groupon and the launch of a new television series ...
最强大的折扣码Pat:33iv2z您可以通过使用独家折扣代码33iv2z从PAT获取购买的巨大折扣关于商店Pat Patpat Shop Patpat Shop独特的中国购物中心专门销售各种母亲,儿童,父母和孕妇该店提供许多不同的产品和各种服装...
TP-COUPON_1.7
Coupon Script 4.0 Create Own Discount Coupon Web Site!
优惠券页面用于展示优惠券各种状态信息demo
自从百度屏蔽淘宝客网站、淘宝抛弃淘宝客之后,...TP-COUPON 导购系统 即是让个人站长实现此心愿的绝佳选择! 欢迎个人站长选用。 V1.1版 更新记录: 1.修正请求时查询淘宝店铺错误的bug 2.删除一些无用的代码
nextpost coupon module
基于drools的优惠券设计,经过测试确实是可行的,但是由于drools本身特性,规则创建比较复杂。
coupon-demo.zip
优雅的使用css3技巧,web前端经常要做一些酷炫的、类似图片的样式,大多数人选择使用图片,一旦图片使用过多对性能肯定有很大影响,所以能用css3实现的尽量用css3实现,上面的文件就是关于优惠券样式的实现方法,...
Ethereum-Coupon 基于以太坊的通用电子优惠券系统 文件目录 coupon_cunstomer_part 是客户的app源码 coupin_merchant_part 是商户的app源码 coupon_git/src/main 是后端源码 coupon_git/src/sql 是数据库 coupon_git...
Laravel开发-laravel-shop-coupon Laravel商品系统-优惠管理
PHP实例开发源码—TP-COUPON 开源PHP优惠券系统.zip PHP实例开发源码—TP-COUPON 开源PHP优惠券系统.zip PHP实例开发源码—TP-COUPON 开源PHP优惠券系统.zip
PHP实例开发源码—TP-COUPON php导购系统 免费版.zip PHP实例开发源码—TP-COUPON php导购系统 免费版.zip PHP实例开发源码—TP-COUPON php导购系统 免费版.zip
v-coupon 一款基于 vue 的卡券组件
当您正在购物的网站上有可用的优惠券时,Coupon Express会通知您。 永远不要忘记再次使用优惠券! 使用Coupon Express作为多合一工具,可以直接在浏览器中查找和共享优惠券。 立即获取您喜欢的商店的独家优惠券,...
Angular---Coupon-System-master.rar
名称:Coupert - Automatic Coupon Finde ---------------------------------------- 版本:6.2.90 作者:https://www.coupert.com/ 分类:商业购物 ---------------------------------------- 概述:Coupert会自动...
coupon: 基于 Laravel 5.5 以上版本的优惠券管理工具
使用Coupon Express作为一个全功能的工具,直接在浏览器中查找和分享优惠券。今天获取您最喜爱的商店的独家优惠券,包括: - 亚马逊 - 百思买 - 去吧爸爸 诺思通 - 穷乡僻壤 - 沃尔玛和成千上万的... 请通过访问...