hdoj-1896 stones】的更多相关文章

Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1363    Accepted Submission(s): 850 Problem Description Because of the wrong status of the bicycle, Sempr begin to walk east to west every…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1896 题目意思:给出 n 块石头的初始位置和能到达的距离.对于第奇数次遇到的石头才抛掷,偶数次的就忽略.问最多能扔到多远.如果有多颗石头在一个位置,距离小的那个标记为先遇到的. 所以先解说一下第二个测试案例: 2 1  5 6  6 在6这个位置的时候,由于5比6小,所以规定1(5)这个点是先遇上的,是偶数次遇到,所以忽略. 用优先队列做,位置近的优先级越高,如果位置相同,距离短的优先级越高. #i…
Problem Description Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time. There are many stones on the road…
Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 662    Accepted Submission(s): 391 Problem Description Because of the wrong status of the bicycle, Sempr begin to walk east to west every m…
一直向前搜..做法有点像模拟.但是要用到出队入队,有点像搜索. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <queue> using namespace std; #define N 100003 struct node { int p,d; bool opera…
还是优先队列 #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; #define maxn 100010 struct Node { int x,y,id; friend bool operator < (Node a,Node b) { if(a.x != b.x) return a.x > b.x; else if…
Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 4165    Accepted Submission(s): 2699 Problem Description Because of the wrong status of the bicycle, Sempr begin to walk east to west ever…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1896 题目大意: 有n个石头,每个石头有:p  它所在的位置 ,d  它能扔多远 从0 开始,遇到第奇数个石头就扔出去,否则则无视,如果同一位置多个石头,则先遇到扔得近的,问最远的石头在什么位置. 采用优先队列. 奇数则p=p+d,弹出,再重新放入,偶数则直接弹出,输出最后一个石头所在的位置. 优先队列: empty() 如果队列为空返回真 pop() 删除对顶元素 push() 加入一个元素 si…
http://acm.hdu.edu.cn/showproblem.php?pid=1896 题意:一个人从0开始走起,遇到偶数个石头就踢.要是同一位置有多个石头,则先扔最重的石头(也就是扔的最近的那个石头),要你求扔的石头离初始位置的最大距离. Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1231    Accepte…
来源1896 Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time. There are many stones on the road, when he mee…