【HDOJ6651】Final Exam(贪心)】的更多相关文章

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3721 来源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26644#problem/F Final Exam Arrangement Time Limit: 4 Seconds      Memory Limit: 65536 KB      Special Judge In Zhejiang Univ…
In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own time slot during the week. We can represent the time slot of a course by an left-closed right-open interval [s, t). Now we are going to arrange the fin…
2019 杭电多校 7 1006 题目链接:HDU 6651 比赛链接:2019 Multi-University Training Contest 7 Problem Description Final Exam is coming! Cuber QQ has now one night to prepare for tomorrow's exam. The exam will be a exam of problems sharing altogether \(m\) points. Cub…
Kejin Player 期望DP 题意: 初始等级为1,每一级有四个参数 r , s , x , a . 每一级有一个概率p=r/s花费a的代价升级到下一级,失败可能会倒退到x级 设从 l 到 r 的期望为 g(l, r), 这种期望满足减法 g(l, r) = g(1, r) − g(1, l). 因为升级只能一级一 级升, 所以要从 1 升级到 r, 必然要经过 l. 求一个前缀和 sum[i+1]=sum[i]+ai * si / ri + (sum[i]-sum[x])*(si-ri)…
一.题目 Final Exam 二.分析 题目说的比较绕,总之一定要记住,$n$个题目都可以做,至少作对$k$到,但是做题目的人不知道每道题对应的分数. 作为出题人,如果他是田忌,肯定不会去在做题目的人可能会做对的$k-1$道题目上去放分,这样的话出题目的人可以使剩下的$n-k+1$道题的分尽可能大,从而防止学生做出$k$道题. 那么作为出题人,能摆出的最优情况就是$\frac{m}{n-k+1}$或者大于$\frac{m}{n-k+1}$的$n-k+1$个题目分,总和肯定还是$m$.(如果是出…
题意:有n门课,价值之和为m,每门课的价值可能是0到m 一门价值为x的课需要花至少x+1时间准备才能通过 问不管价值如何分配都能通过至少k门课的最小总准备时间 m,n,k<=1e9 思路: #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int&g…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3721 容易的贪心题,排个序.. //STATUS:C++_AC_840MS_6272KB #include <functional> #include <algorithm> #include <iostream> //#include <ext/rope> #include <fstream> #include…
3721: PA2014 Final Bazarek Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 610  Solved: 243[Submit][Status][Discuss] Description 有n件商品,选出其中的k个,要求它们的总价为奇数,求最大可能的总价. Input 第一行一个整数n(1<=n<=1000000),表示商品数量.接下来一行有n个整数,表示每件商品的价格,范围在[1,10^9].接下来一行有一个整数m(1&l…
[BZOJ3721]PA2014 Final Bazarek Description 有n件商品,选出其中的k个,要求它们的总价为奇数,求最大可能的总价. Input 第一行一个整数n(1<=n<=1000000),表示商品数量.接下来一行有n个整数,表示每件商品的价格,范围在[1,10^9].接下来一行有一个整数m(1<=m<=1000000),表示询问数量.接下来m行,每行一个整数k[i](1<=k[i]<=n). Output 对于每个询问,输出一行表示保证奇数的…
问题链接:http://www.bnuoj.com/v3/contest_show.php?cid=4329#problem/F   问题大意:         就是有1--N们课程,每一个课程都有一个考试区间[s,t),左闭右开,没有时间重叠的课程不能安排在一起,让尽量多的课程安排在一起,最少能安排多少天,并输出先后的课程: 题目分析:        贪心算法的综合运用,关键看怎么贪心,求重叠部分最多的,这个题不同于一般的贪心.我的做法是首先定义一个结构体里面包括课程序号.开始区间S.结束区间…
1.algorithm analysis O B/W/AV/AMOR,混入其他问题,设计+分析 2.传统算法(肯定要考) 1)divide and conquer master therem. recursive tree.分析复杂度.递归树加起来得到最终结果 2)greedy algorithm example sort->select 拟阵 独立系统的贪心模板,直接得到近似比 3)dynamic programming sub-optimal structrue.编辑距离 3.graph a…
题意:告诉你n 个科目的考试日期,在考试当天不能复习,每一个科目的最早复习时间不能早于考试时间的t天,每一天你可以复习完一科,也只能复习一科,求最晚的复习时间!. 析:由于题目给定的时间都在1900 ~ 2100 之间,所以先预处理时间,然后把每个科目按照考试时间最晚的优先策略进行排序,从后向前扫,看看能不能在规定时间内完成复习,然后维护一个优先队列,这个优先策略是开始时间减去 t 最大的优先,因为我们是从后向前找,肯定是越大越应该完成,要不然就完不成了,如果中间有完成不成的,就是不可能,否则就…
秋季学期的java已经结课了,当看到教务平台贴出的通知说考试形式为单选题时,心中喜忧参半. 可喜的是这种考试形式还是比较得民心,毕竟除了判断题,最好做的也就是单选题了. 然而期中考试选择题50%的命中率还历历在目,不免心生忧虑.然后后来的事实证明,果然我的忧虑不是毫无道理的,再次被虐,而且被虐的毫无怨言. 考试完后把还有印象的几道题目在eclipse上跑了跑,结果也是不堪回首.... 然后我决定把它们记下来,以期在不远的将来能够一雪前耻. #1.对,你没有看错,就是这道题,我当时靠着卓越的逆向思…
如果没有限制,直接取前 $k$ 大即可. 有限制,则只有几种可能:奇换偶,偶换奇. 维护奇数偶数的前缀最小值和后缀最大值即可. code: #include <bits/stdc++.h> #define N 1000005 #define LL long long #define inf 2000000000 using namespace std; namespace IO { char *p1,*p2,buf[100000]; #define nc() (p1==p2&&…
hdu题面 Time limit 2000 ms Memory limit 524288 kB OS Windows 吐槽 比赛时候晕死了-- 解题思路 先留坑 公式法 https://blog.csdn.net/qq_43316231/article/details/99320860 https://blog.csdn.net/weixin_44327262/article/details/99326110 https://blog.csdn.net/toohandsomeieaseid/ar…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6651 题意:n个科目,总共m分,通过一科需要复习花费科目分数+1分钟,在不知道科目分数的情况下,问最少需要复习多少分钟使得一定可以通过至少k科. 因为需要通过k科,所以最坏的情况是n-k+1科复习时间不够(即只通过k-1科),所以我们要让复习时间最少的n-k+1科其中任选一科都不拖后腿.我们将m分 平均分配到n-k+1科中,如果分配不均则让一些科多复习一分钟,同时在其余k-1科都要复习比n-k+1科…
题意: 有n道题,这n道题共m分,要求你至少做出k道才能及格,你可以自由安排复习时间,但是只有某道题复习时间严格大于题目分配的分值时这道题才能够被做出来,求最少的,能够保证及格的复习时间.复习时间和分数都是整数. 题解: 为什么给这道题一个博弈的标签呢?因为这道题其实是这样一个博弈过程: 第一回合,玩家A给自己的n个题分配复习时间 第二回合,玩家B拿到m个分数,去给题目分配分数,卡A的复习成果,只要分数和复习时间完全一样就相当于卡掉了,至少卡掉n-k+1个题B就获胜 明白了吧,学生对于题目分数分…
题目链接: A. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly …
A. Exams Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/480/problem/A Description Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera…
题目: C. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly ne…
Final Exam HDOJ-6651 这里主要考察我们的思维能力,要想自己至少可以通过k道题目,那么可以从老师的角度出发:怎么才能尽可能让你每一道题目都不通过,但是分数却是固定的. 假设我们每道题目复习x分钟,要想让你这道题不过,则分数应该最小为x,那么你这道题就过不了. 为了自己k道题目可以过,那么一定要让前面的n-k+1道题目的分数大于m,到了老师没有分来分配的时候,剩下的就是可以通过的题目数了. 还有一个问题需要注意的是题目数据的大小,需要使用longlong型的,否则WA #incl…
Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Academia.edu) ADDITIONAL PRACTICE FOR THE FINAL PROBLEM 1 A box contains 8 dark chocolates, 8 milk chocolates, and 8 white chocolates. (It’s amazing how t…
Stat2.3x Inference(统计推断)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Academia.edu) ADDITIONAL PRACTICE FOR THE FINAL In the following problems you will be asked to choose one of the four options (A)-(D). The options are sta…
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then…
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then…
https://pintia.cn/problem-sets/994805342720868352/problems/994805345401028608 For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first ob…
1137 Final Grading(25 分) For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programm…
In Professor McGonagall's class of Transfiguration, Harry Potter is learning how to transform one object into another by some spells. He has learnt that, to turn a cat into a mouse one can say docamo! To reverse the effect, simply say decamo! Formall…
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then…
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then…