HDU 4302 Contest 1】的更多相关文章

维护两个优先队列即可.要注意,当出现蛋糕的位置刚好在狗的位置时,存在右边. 注意输出大小写... #include <iostream> #include <queue> #include <cstdio> using namespace std; struct RP{ int pos; bool operator < (const RP &t)const{ if(pos>t.pos) return true; return false; } };…
http://acm.hdu.edu.cn/showproblem.php?pid=4302 #include <cstdio> #include <cstring> #include <queue> #include <vector> #include <algorithm> #define maxn 100010 using namespace std; int n,m,a,b; int main() { int t; scanf("…
http://acm.hdu.edu.cn/showproblem.php?pid=4302 题意: 在一条直线上,会有多条命令,如果是0,那么就会在x位置处出现一个蛋糕,如果是1,某人就会找到最近的蛋糕去吃.一开始在0坐标处,如果两边都有距离相同的蛋糕,则不改变方向.求经过的总距离. 思路: multiset维护,每次1命令时在multiset找距离最近的即可. #include<iostream> #include<cstdio> #include<set> usi…
Problem Description In the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems.  On Mars, there is programming contest, too. Each team c…
意甲冠军:N个人M通过主打歌有自己的期望,每个问题发送人玩.它不能超过随机播放的次数1,追求最大业绩预期 (1 ≤ N ≤ 10,1 ≤ M ≤ 1000). 主题链接:pid=5045" target="_blank">http://acm.hdu.edu.cn/showproblem.php?pid=5045 -->>设dp[i][j]表示已出战了前i - 1道题目,已出战的人的状态序列为j,如今要做第i道题目的最大期望.则最后要求的结果为max{dp[…
Contest Problem Description In the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems. On Mars, there is programming contest, too. Each…
Holedox Eating Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2862    Accepted Submission(s): 952 Problem Description Holedox is a small animal which can be considered as one point. It lives in…
Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2653    Accepted Submission(s): 579 Problem Description A coding contest will be held in this university, in a huge playground. The…
进一步学习了优先队列的用法 题意:一只小动物在直线上走,起始位置为零,之后会出现食物,动物要去距离自己最短的食物那,若两边的食物距离相等,则选择之前走的方向的食物 0 x,代表x的位置出现了食物,1代表去吃一个食物 #include<stdio.h> #include<queue> #include<iostream> #include<algorithm> using namespace std; struct cmp { bool operator()(…
题解:我们使用一个二位数组dp[i][j]记录进行到第i个任务时,人组合为j时的最大和(这里的j我们用二进制的每位相应一个人). 详细见代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; typedef long long ll; double s[11][1010]; double dp[1010][1050];…