Algorithm lesson final exam】的更多相关文章

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…
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…
题目: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…
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)…
Yandex.Algorithm 2018, final round A Smart Vending B LIS vs. LDS C Eat And Walk D Search Engine E Guess Me If You Can 思路:如果n这个位置加1的话,不同的数的个数要么不变,要么加1,反之,如果不同的数的个数减少,肯定不是n这个位置加1 我们random_shuffle()50次,每次把不是n的位置标记一下,这样有很大的概率把所有的不是n的位置都标记了 代码: #pragma GC…
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…
一.题目 Final Exam 二.分析 题目说的比较绕,总之一定要记住,$n$个题目都可以做,至少作对$k$到,但是做题目的人不知道每道题对应的分数. 作为出题人,如果他是田忌,肯定不会去在做题目的人可能会做对的$k-1$道题目上去放分,这样的话出题目的人可以使剩下的$n-k+1$道题的分尽可能大,从而防止学生做出$k$道题. 那么作为出题人,能摆出的最优情况就是$\frac{m}{n-k+1}$或者大于$\frac{m}{n-k+1}$的$n-k+1$个题目分,总和肯定还是$m$.(如果是出…
题目链接: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…
问题链接:http://www.bnuoj.com/v3/contest_show.php?cid=4329#problem/F   问题大意:         就是有1--N们课程,每一个课程都有一个考试区间[s,t),左闭右开,没有时间重叠的课程不能安排在一起,让尽量多的课程安排在一起,最少能安排多少天,并输出先后的课程: 题目分析:        贪心算法的综合运用,关键看怎么贪心,求重叠部分最多的,这个题不同于一般的贪心.我的做法是首先定义一个结构体里面包括课程序号.开始区间S.结束区间…
题目链接: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科…