hdu4882 水贪心】的更多相关文章

题意:      给你n个任务,每个任务有两个权值,t[i],b[i],前面的是完成任务所需时间,后面的那个是个参数,每个任务完成的代价是完成当前任务总时间(之前的+现在的) sumt * b[i],问你完成所有任务的总花费最小是多少. 思路:      水贪心吧,不给证明了,没啥意思,就想象一下,那个东西价值贵就先干那个就行了 价值等于 b[i] / t[i],价值贵的放到最后干会吃亏的. #include<stdio.h> #include<algorithm> using n…
A. Shell Game time limit per test 0.5 seconds memory limit per test 256 megabytes input standard input output standard output Bomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played b…
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of…
[题目大意] 有n个头牛,给出体重和力量.每个牛的危险值等于它上面的牛的体重总和减去它的力量值,求所有方案中危险值最大值的最小值. [思路] 贪心.一开始脑补的贪心是体重大的先放下面,体重相同的根据力量值来排.但是其实是不对的QAQ 这里有详细证明: 首先要想到,对于相邻的两头牛,交换它们的位置,仅仅会影响他们两个的risk值 然后,对于最优系列的相邻的两头牛 w1 s1 w2 s2 最顶上的那头的顶上的牛的质量和为sum. 那么第一头牛的risk就是 sum - s1……r1 第二头的为sum…
A. Buy a Shovel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is so…
A. Vitya in the Countryside time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every gran…
B. Equidistant String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her string…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2021 发工资咯:) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 75799    Accepted Submission(s): 40514 Problem Description 作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天…
C Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2102 Description You are given two positive integers A and B in Base C. For the equation: A=k*B+d We know there always existing many non-negativ…
题目:http://poj.org/problem?id=2376 英文题强行看不懂,只看的懂输入输出,输入n,m,下接n行每行一个区间两个数左端点 l,有端点 r 给出n个闭区间,求选择最少的区间能够完全覆盖[1,m] 经典的区间覆盖问题,按左端点升序排序 首先当前卡点为1,选择小于等于当前卡点的,尽量往右边扩 直到大于当前卡点,再将卡点设为右边能扩展到的最大值 统计答案,注意闭区间和左端点最小区大于 1 的情况 #include<cstdio> #include<cstdlib>…