Kattis - fairdivision 【贪心】】的更多相关文章

题意 有一堆人 要给他们的朋友 买一个生日礼物,然后 每个人 给出自己的最大负担额度 并且给出礼物总价 然后要给出一种解决方案 尽量让 所有人的支出都接近平均,如果实在无法平均,那就让 先来的人 多处 思路 用贪心的思路,我们先将负担额度排序,第一个关键字是负担额度,第二个关键字是进来的先后次序,按双关键字排序,先按负担额度从小到大,若负担额度相等,再按进来的先后次序从大到小 然后 比较每一个人的负担额度 与 平均值的关系,如果小于等于平均值 那么它就出这个负担额度的钱,如果大于平均值,就出平均…
Installing Apps Kattis - installingapps Sandra recently bought her first smart phone. One of her friends suggested a long list of applications (more commonly known as “apps”) that she should install on the phone. Sandra immediately started installing…
思路 先将 N 个 电视节目 排序 根据 结束时间 ,结束的早的 排在前面 然后 弄 K个标记 记录 结束时间 然后 遍历一下 每次 如果能插入的话 插入到 结束时间最小的那个 队列里面去然后 每次插入后 更新答案 AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #include <climits> #include <iostr…
题意 有两个人想去一起看电影,然后分别给出两个人 分别喜欢看的电影都在哪些天 然后 同一个人 不能连续看两天他不喜欢的电影 求他们最多可以看多少次电影 思路 先将两人喜欢看的电影进行排序, ① 选择两个人中喜欢看的电影中的天数次序小的进行观看 ②标记FLAG 看了一个人的 下次选择另一个人的 ③如果另一个人喜欢看的电影的天数次序大于上次那个人的天数次序 则返回② ④如果一个人喜欢看的电影的天数次序等于上次那个人的天数次序 则返回② 跳出循环条件 ① 两个人的电影都选完了 则直接BREAK ② 两…
原题网址:https://open.kattis.com/problems/classrooms Classrooms The new semester is about to begin, and finding classrooms for orientation activities is always a headache. There are k classrooms on campus and n proposed activities that need to be assigne…
1692: [Usaco2007 Dec]队列变换 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 1383  Solved: 582[Submit][Status][Discuss] Description FJ打算带他的N(1 <= N <= 30,000)头奶牛去参加一年一度的“全美农场主大奖赛”.在这场比赛中,每个参赛者都必须让他的奶牛排成一列,然后领她们从裁判席前依次走过. 今年,竞赛委员会在接受队伍报名时,采用了一种新的登记规则:他们把所…
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15564    Accepted Submission(s): 6405 Problem Description There is a pile of n wooden sticks. The length and weight of each stick a…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784    Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
1691: [Usaco2007 Dec]挑剔的美食家 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 786  Solved: 391[Submit][Status][Discuss] Description 与很多奶牛一样,Farmer John那群养尊处优的奶牛们对食物越来越挑剔,随便拿堆草就能打发她们午饭的日子自然是一去不返了.现在,Farmer John不得不去牧草专供商那里购买大量美味多汁的牧草,来满足他那N(1 <= N <= 100,…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…