hdu3339 In Action(Dijkstra+01背包)】的更多相关文章

/* 题意:有 n 个站点(编号1...n),每一个站点都有一个能量值,为了不让这些能量值连接起来,要用 坦克占领这个站点!已知站点的 之间的距离,每个坦克从0点出发到某一个站点,1 unit distance costs 1 unit oil! 最后占领的所有的站点的能量值之和为总能量值的一半还要多,问最少耗油多少! */ /* 思路:不同的坦克会占领不同的站点,耗油最少那就是路程最少,所以我们先将从 0点到其他各点的 最短距离求出来!也就是d[i]的值!然后我们又知道每一个站点的所具有的能量…
  Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the globe.  Nowadays,the crazy boy in FZU named AekdyCoin possesses some nuclear weapons and wanna destro…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=203 思路:先求点0到每个点的最短距离,dijkstra算法,然后就是01背包了 我奇怪的是100*1000000的时间复杂度居然没有超时! 代码如下: #include "stdio.h" #include "string.h" #define N 105 #define INF 0x3fffffff bool mark[N]; int dist[N];…
In Action Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4720 Accepted Submission(s): 1553 Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team i…
描述 <三国志>是一款很经典的经营策略类游戏.我们的小白同学是这款游戏的忠实玩家.现在他把游戏简化一下,地图上只有他一方势力,现在他只有一个城池,而他周边有一些无人占的空城,但是这些空城中有很多不同数量的同种财宝.我们的小白同学虎视眈眈的看着这些城池中的财宝. 按照游戏的规则,他只要指派一名武将攻占这座城池,里面的财宝就归他所有了.不过一量攻占这座城池,我们的武将就要留守,不能撤回.因为我们的小白手下有无数的武将,所以他不在乎这些. 从小白的城池派出的武将,每走一公理的距离就要消耗一石的粮食,…
In Action Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3869    Accepted Submission(s): 1237 Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project t…
<题目链接> 题目大意: 给出一个0-n组成的图,1-n的点上分布着值为pow的电站,给出图的m条边以及距离,从0出发到n个点中的x个点的行走距离和最小(因为是每炸一个点派出一辆坦克),且x个点的pow之和必须超过总的pow和的一半. 解题分析: 由于本题数据范围很小,只有100,所以我们能够用floyed算出0到任意一点的最短距离,然后将所有0可达的点看成物品,0到它们的最短距离看成体积,这样将所有可达物品最短距离之和看成背包容量,这些可达点的pow看成价值,然后再用01背包.dp[i]表示…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=3339 In Action Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7869    Accepted Submission(s): 2674 Problem Description Since 1945, when the first…
In Action Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5472    Accepted Submission(s): 1843 Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project t…
题目链接: 题目 In Action Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 问题描述 Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across th…