Moo University - Financial Aid】的更多相关文章

Moo University - Financial Aid 其实是老题了http://www.cnblogs.com/Philip-Tell-Truth/p/4926008.html 这一次我们换二分法来做这一道题,其实二分法比我以前那个方法好想一点,主要是这次我们可以根据下标进行二分,然后排两次序,第一次是根据分数来排序,然后记录分数的序,接下来就把aid排一次序,然后我们就可以进行二分了 参考http://www.hankcs.com/program/cpp/poj-2010-moo-un…
Moo University - Financial Aid Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6020 Accepted: 1792 Description Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fe…
                                                                                            Moo University - Financial Aid Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7961   Accepted: 2321 Description Bessie noted that although human…
POJ 2010 Moo University - Financial Aid 题目大意,从C头申请读书的牛中选出N头,这N头牛的需要的额外学费之和不能超过F,并且要使得这N头牛的中位数最大.若不存在,则输出-1(一开始因为没看见这个,wa了几次). 这个题的第一种做法就是用两个优先队列+贪心. /* * Created: 2016年03月27日 14时41分47秒 星期日 * Author: Akrusher * */ #include <cstdio> #include <cstdl…
Moo University - Financial Aid Descriptions 奶牛大学:奶大招生,从C头奶牛中招收N(N为奇数)头.它们分别得分score_i,需要资助学费aid_i.希望新生所需资助不超过F,同时得分中位数最高.求此中位数. Input *第1行:三个以空格分隔的整数N,C和F *第2..C + 1行:每行两个以空格分隔的整数.首先是小牛的CSAT分数; 第二个整数是小牛所需的经济援助金额 Output *第1行:一个整数,即Bessie可以达到的最大中位数分数.如果…
Moo University - Financial Aid Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6599   Accepted: 1926 Description Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and he…
Description Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows formed a new university called The University of Wisconsin-Farmside,"Moo U" for short. Not wish…
Description Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows formed a new university called The University of Wisconsin-Farmside,"Moo U" for short. Not wish…
题目地址 分析:如果用二分法,关键是score和aid分开排序,score排序是为了充分利用中位数的性质,这样就可以确定m左右必须各选N/2个,到这之后有人是用dp求最优解,可以再次按照aid排序一次,可以直接确定最优解(肯定是从最小的开始选择!): #include <cstdio> #include <algorithm> #include <cstring> using namespace std; int N, C, F; ; struct Cow{ int i…
   牛的学校 题目大意:这只Bessie真是太顽皮了,她又搞了个学校,准备招生,准备通过一个考试筛选考生,但是不能招到每个学生,每个学生也不能一定能上学,要资助,问你在一定资金内,怎么收学生,使收到的学生的平均分最高? 这一道题怎么做呢?我们知道,题目给了一个条件就是N一定是奇数,这样其实就给了我们一个套路,那就是N一定是中间的那个数,一开始我想着用一个堆去从头到尾查找,结果想了很久还是失败了. 其实这一道题要用到两个堆,分别储存左翼和右翼,我们想得到N在中间的时候左翼和右翼加起来在资金的时候…