POJ 1323 Game Prediction#贪心】的更多相关文章

(- ̄▽ ̄)-* //既然是求最少能胜几次 //说明对方是要尽可能让我输 //但为了避免浪费,对方会用比我的牌大的牌中的最小pip的牌来击败我 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { ; ],vis[]; while(scanf("%d%d",&m,&…
Game Prediction Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8956   Accepted: 4269 Description Suppose there are M people, including you, playing a special card game. At the beginning, each player receives N cards. The pip of a card i…
POJ 3190 Stall Reservations贪心 Description Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000,000), which includes both times A and B. Obvi…
POJ 2392 Space Elevator(贪心+多重背包) http://poj.org/problem?id=2392 题意: 题意:给定n种积木.每种积木都有一个高度h[i],一个数量num[i].另一个限制条件,这个积木所在的位置不能高于limit[i],问能叠起的最大高度? 分析: 本题是一道多重背包问题, 只是每一个物品的选择不只要受该种物品的数量num[i]限制, 且该物品还受到limit[i]的限制. 这里有一个贪心的结论: 我们每次背包选取物品时都应该优先放置当前limit…
Cleaning Shifts 题目连接: http://poj.org/problem?id=2376 Description Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided…
Frogs' Neighborhood Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 6076   Accepted: 2636   Special Judge Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居.现在已知每只青蛙的邻居数目x1,x2, ...,…
POJ 3045 Cow Acrobats 这是个贪心的题目,和网上的很多题解略有不同,我的贪心是从最下层开始,每次找到能使该层的牛的风险最小的方案, 记录风险值,上移一层,继续贪心. 最后从遍历每一层的风险值,找到其中的最大值 我一开始对sum-p[i].a-p[i].b从小到大排序,这样第一次取出的就是能使最下层的牛的风险最小的方案,在上移一层时,这一层的风险值   为sum-p[i].a-p[i].b-p[0].a,由于p[0].a是固定值,所以第二次直接取出的就是能使该层的牛的风险最小的…
题目链接:http://poj.org/problem?id=3614 题意:C头牛去晒太阳,每头牛有自己所限定的spf安全范围[min, max]:有L瓶防晒液,每瓶有自己的spf值和容量(能供几头牛用). 求这L瓶防晒液最多能让多少头牛安全地晒太阳. 思路:贪心策略,按spf从小到大或从大到小的顺序取出防晒液,供给尽可能多的剩余的牛. 具体如何判断当前这瓶防晒液最多能供给几头牛呢? 以spf从小到大排序所有防晒液为例,可以维护一个小顶堆,每取出一瓶防晒液l,就把剩余的所有min值低于l.sp…
题目链接:http://poj.org/problem?id=2499 思路分析:结点向左边移动时结点(a, b)变为( a+b, b),向右边移动时( a, b )变为( a, a + b); 为求最短路径<a1, a2, a3,...,an>, 考虑从已经知道的结点(a, b)开始找出最短路径回到根节点(1, 1),即向左移动次数和向右移动次数最少回到根节点,由贪心算法, 若 a>b 时,a 减少最大即减去 b,若 a < b,b 减少最大即减去a值,循环直到到达根节点(1,…
POJ 1328 Radar Installation https://vjudge.net/problem/POJ-1328 题目: Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation…