POJ 1018 Communication System(树形DP)】的更多相关文章

Description We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacturers. Same devices from two manufacturers d…
http://poj.org/problem?id=1018 题意: 某公司要建立一套通信系统,该通信系统需要n种设备,而每种设备分别可以有m1.m2.m3.....mn个厂家提供生产,而每个厂家生产的同种设备都会存在两个方面的差别:带宽bandwidths 和 价格prices. 现在每种设备都各需要1个,考虑到性价比问题,要求所挑选出来的n件设备,要使得B/P最大. 其中B为这n件设备的带宽的最小值,P为这n件设备的总价. 思路:DP解决. d[i][j]代表选择第i个设备时最小带宽j时的价…
We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacturers. Same devices from two manufacturers differ in the…
点击打开链接 Communication System Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21007   Accepted: 7449 Description We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several d…
Communication System Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21631   Accepted: 7689 Description We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices.…
Description We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacturers. Same devices from two manufacturers d…
Communication System Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22380   Accepted: 7953 Description We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices.…
看题传送门:http://poj.org/problem?id=1018 题目大意: 某公司要建立一套通信系统,该通信系统需要n种设备,而每种设备分别可以有m个厂家提供生产,而每个厂家生产的同种设备都会存在两个方面的差别:带宽bandwidths 和 价格prices. 现在每种设备都各需要1个,考虑到性价比问题,要求所挑选出来的n件设备,要使得B/P最大. 其中B为这n件设备的带宽的最小值,P为这n件设备的总价. 思路: 贪心+枚举 要使得B/P最大,则B应该尽量大,而P尽量小. 可以按照价格…
本题一看似乎是递归回溯剪枝的方法.我一提交,结果超时. 然后又好像是使用DP,还可能我剪枝不够. 想了非常久,无奈忍不住偷看了下提示.发现方法真多.有贪心,DP,有高级剪枝的.还有三分法的.八仙过海各显神通啊. 坏习惯了,没思考够深入就偷看提示了. 幸好及时回头,还不须要看别人的代码了.自己做出来之后,有空看看多种解法的代码也好. 然后我想出自己的思路了,使用贪心,剪枝,DP综合优化下,呵呵.最后程序有点复杂.优化到了16ms,运气好点,或者vector换成原始数组的话,应该能够0MS了. 整体…
/*poj 2324 Anniversary party(树形DP) ---用dp[i][1]表示以i为根的子树节点i要去的最大欢乐值,用dp[i][0]表示以i为根节点的子树i不去时的最大欢乐值, ---于是当i去时,i的所有儿子都不能去:dp[i][1]=sum(dp[j][0])+a[i],其中j是i的儿子节点. ---当i不去时,i的儿子可去也可不去:dp[i][0]=sum(max(dp[j][0],dp[j][1])),j是i的儿子节点 ---边界条件:当i时叶子节点时,dp[i][…