CodeForce-762B USB vs. PS/2(贪心)】的更多相关文章

Codeforces 762B 题目大意: 有a台只有USB接口的电脑,b台PS/2接口的电脑,c台两种接口都有的电脑.每台电脑只用装一个鼠标.给出n个鼠标及其费用,每个鼠标只能使用一遍.在最大化有鼠标的电脑数目的情况下最小化费用. \((0 \le a,b,c \leq 10^5 , n \leq 3*10^5 )\) 题解: 这道题我们很容易抽象出来一个网络流模型 我们设超级源汇为S,T,每台电脑和鼠标都抽象成一个节点 我们可以这么建图 S -> 每台电脑 (flow = 1,cost =…
USB vs. PS/2 CodeForces - 762B 题意:有三种电脑,分别有a.b.c个,第一种只有USB接口,第二种只有PS/2接口,第三种有两种接口,有m个鼠标,告诉你价钱和接口类型,问最多有多少电脑和鼠标可以配对,这些鼠标最少花多少钱. Input 2 1 145 USB6 PS/23 PS/27 PS/2 Output 3 14 解题思路:将两种鼠标分类后根据价钱来排序,先处理只有USB和只有PS/2接口的,然后两种鼠标取价钱少的来处理既有USB又有PS/2接口的 #inclu…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task o…
排序水题 #include<iostream> #include<cstdlib> #include<cstdio> #include<algorithm> #include<math.h> using namespace std; int n,m; ]; int main() { scanf("%d",&n); scanf("%d",&m); ;i<n;i++) { scanf(&q…
Liebig's Barrels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have m = n·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, y…
Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat. There is a big shop uptown and Malek wants to buy meat for her from there. In i-th day, they sell mea…
Description There are n piles of stones of sizes a1, a2, -, an lying on the table in front of you. During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i,…
转自关于键盘冲突那点事(3键冲突/7键冲突/PS2/USB的各种原理) 最近闲得无聊,正好看到有人发帖提问,于是就来详细说说所谓键位冲突和无冲突的各种原理--基本上这也是个老生常谈的话题了,但相关的技术帖比较零乱难找,而且充斥了大量电工术语,也不是很容易看懂.这里就尽量用通俗易懂的语言来讲(我的目标是即使你只有初中文化水平也能看懂,保守地说绝对不超过高中文科生能理解的范围),帖子比较长,有兴趣的朋友请慢慢阅读.慢慢看,用心理解,包你看懂. 为了降低阅读门槛,本文难免有不严谨之处,还请工科同学高抬…
Report descriptors are composed of pieces of information. Each piece of information is called an Item.报告描述符由一些数据片组成.这些数据片被叫做Item.All items have a one-byte prefix that contains the item tag, item type, and item size. 每一个Item都包含一个字节的前缀,这个前缀中包含了三个信息--it…
PS:$引用变量的时候不要加空格.用了case,while的结构. main文件 #!/bin/bash chmod a+x changedate chmod a+x changemod chmod a+x usb chmod a+x findfile chmod a+x compression clear while true do echo "welcome to my program" echo "wish you have a good day" echo…