题目是给一个无向图,其中每个节点都有点权,边也有边权,然后就有2个小朋友开始做游戏了ALICE &BOB 游戏规定ALICE 先行动然后是BOB,然后依次轮流行动,行动时可以任意选取一个节点并获得节点的点权,如果他已经把一条边的2个端点都取了,那么他可以获得那边的边权,如果一条边的二个端点不同的人取了,那么谁也得不到那条变得边权了. 问游戏结束后怎样可以使ALICE得到的权值和减去BOB 的权值和最大,当然二个人都一样足够聪明,即每次行动都会采取最优的策略 解法若没有边权,则对点权从大到小排序即…
A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named Haha and Xixi in the universe and they were created with the universe beginning. There is 73 days in Xixi a year and 137 days in Haha a year. Now you k…
Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1418    Accepted Submission(s): 417 Problem Description The empire is under attack again. The general of empire is planning to defend h…
题意: 有N个点,M条边. 点有权值, 边有权值. Alice, Bob 分别选点. 如果一条边的两个顶点被同一个人选了, 那么能获得该权值.问 Alice - Bob? 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4647 思路: 贪心. 对于一条边来说, 如果拿了一个点, 说明已经拿了该边的一半权值. 如果某边的两个的顶点分别是不同的人.  那么差值还是不变的.  如果某边的两个顶点分别是同一个人. 那么和值也不变. 所以我们可以把一个边分解到两…
摘自题解: 若没有边权,则对点权从大到小排序即可.. 考虑边,将边权拆成两半加到它所关联的两个点的点权中即可. ..因为当两个人分别选择不同的点时,这一权值将互相抵消. 代码如下: #include <cstdio> #include <cstring> #include <algorithm> #define LL long long #define INF 0x7fffffff #define M 100010 using namespace std; int co…
题目链接 思路题.看的题解. #include <cstdio> #include <string> #include <cstring> #include <algorithm> using namespace std; #define LL __int64 LL p[]; int main() { int i,n,m,sv,ev,w; while(scanf("%d%d",&n,&m)!=EOF) { memset(p…
官方题解: 若没有边权,则对点权从大到小排序即可.. 考虑边,将边权拆成两半加到它所关联的两个点的点权中即可. ..因为当两个人分别选择不同的点时,这一权值将互相抵消. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; ; int N, M; double node[MAXN]; int main() { whil…
解题思路:若没有边权,则对点权从大到小排序即可.. 考虑边,将边权拆成两半加到它所关联的两个点的点权中即可. ..因为当两个人分别选择不同的点时,这一权值将互相抵消. 以上摘自杭电的解题报告. 至于为什么,还想得不是很清楚···· 由于在处理时使用的是整数,整数/2,当为奇数时0.5就不见了,所以直接把点的权值翻倍,最后结果除以2,这算是一个技巧吧···· 贴代码: #include <cstdio> #include <algorithm> #define N 100005 us…
It's All In The Mind 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5742 Description Professor Zhang has a number sequence a1,a2,...,an. However, the sequence is not complete and some elements are missing. Fortunately, Professor Zhang remembers some…
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1038 Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5226    Accepted Submission(s): 3476 Problem Description Most bicycle…