POJ1018Communication System题解动态规划DP

poj算法题1018——Communication System Communication SystemDescriptionWe 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 choo 阅读详情
Communication System
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 12607 Accepted: 4377

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 differ in their maximum bandwidths and prices.
By overall bandwidth (B) we mean the minimum of the bandwidths of the chosen devices in the communication system and the total price (P) is the sum of the prices of all chosen devices. Our goal is to choose a manufacturer for each device to maximize B/P.

Input

The first line of the input file contains a single integer t (1 ≤ t ≤ 10), the number of test cases, followed by the input data for each test case. Each test case starts with a line containing a single integer n (1 ≤ n ≤ 100), the number of devices in the communication system, followed by n lines in the following format: the i-th line (1 ≤ i ≤ n) starts with mi (1 ≤ mi ≤ 100), the number of manufacturers for the i-th device, followed by mi pairs of positive integers in the same line, each indicating the bandwidth and the price of the device respectively, corresponding to a manufacturer.

Output

Your program should produce a single line for each test case containing a single number which is the maximum possible B/P for the test case. Round the numbers in the output to 3 digits after decimal point.

Sample Input

1 3
3 100 25 150 35 80 25
2 120 80 155 40
2 100 100 120 110

Sample Output

0.649

Source

Tehran 2002, First Iran Nationwide Internet Programming Contest
状态:
设d[i][j]表示前i组带宽为j时的最小价格
状态转移方程:
d[i][j]=min{d[i-1][j]+p[i][k]};   (b[i][k]>=j)
ans=max{j/d[n][j]}
j枚举到400
代码:
iphone查看/private/var/mobile/Containers/Data/Application/文件 xcode查看iPhone的private/var/文件夹xcode连接iPhone真机选择app下载Containers文件夹到mac电脑中查看手机中下载的文件 使用xcode真机调试的时候,文件目录都是这种/private/var/mobile/Containers/Data/Application/FAEFDF4D-5CE4-474F-9C53-C19789DB59F6/tmp/ xcode连接iPhone真机 不需要越狱,使用xcode上连接iPhone,然后选择运行的app,选择window-&g 阅读详情

相关推荐

openwrt编译及第一个安装包教程

Date: 2017.03.14 Made:SuperDeverloper Email: na1206@live.com Target: For mt7688 based board说明:本人在学习过程中走了不少弯路,希望本文档能为后来者提供便利。欢迎复制和使用本文档。本文档记录了搭建openwrt编译环境以及快速创建ipk包(openwrt上的安装程序)。本文档在实际应用中做过几次修改,以帮

SuperDevloper的博客 1万+

poj1018 枚举+剪枝

大致题意: 某公司要建立一套通信系统,该通信系统需要n种设备,而每种设备分别可以有m1、m2、m3、...、mn个厂家提供生产,而每个厂家生产的同种设备都会存在两个方面的差别:带宽bandwidths 和 价格prices。 现在每种设备都各需要1个,考虑到性价比问题,要求所挑选出来的n件设备,要使得B/P最大。 其中B为这n件设备的带宽的最小值,P为这n件设备的总价。      解题

zht的专栏 3694

UE5深度图与Mask图渲染实战:从基础到高级应用

本文详细解析了在UE5中渲染深度图与Mask图的完整实战流程。从启用电影渲染队列、配置自定义深度模板通道等前期准备,到构建即用型深度图材质网络与精准物体Mask生成,并深入探讨了二者结合在NPR风格化、程序化雾气及AI工作流(如ComfyUI)中的高级应用,为影视、游戏后期与AI创作提供了高效的解决方案。

weixin_29001419的博客 353

Communication System(动规or贪心)

妙笔难书一纸愁肠,苍白的誓言,终究抵不过岁月的遗忘。 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 f...

0k-ok 609

医疗领域BGE-M3模型微调全流程:从数据准备到效果评估

本文详细介绍了医疗领域BGE-M3模型的微调全流程,从数据准备到效果评估。通过医疗数据微调,BGE-M3模型在临床问答、病历检索等场景中表现显著提升,能够准确理解医学术语之间的细微差别。文章还提供了实战练习代码和效果评估指标,帮助开发者快速掌握医疗文本嵌入模型的应用技巧。

weixin_29098367的博客 287

手把手教你用迅为RK3588核心板搭建无人机飞控系统(附完整开发指南)

本文详细介绍了如何利用迅为RK3588核心板搭建高性能无人机飞控系统,涵盖硬件选型、开发环境配置、传感器数据融合、控制算法实现及系统测试全流程。RK3588凭借其强大的计算能力和丰富接口,为无人机控制解决方案提供了理想平台,特别适合需要实时处理的复杂飞行任务。

weixin_29062255的博客 378

POJ 1018--Communication System

poj 1018

Hering_Linux的专栏 635

Mybatis Provider注解实现批量插入

需求 借助mybatis 的provider实现一个比较通用的,批量插入数据接口。 Mapper接口 第一参数为需要批量插入的数据,第二个参数为对应实体类的class public interface BaseDao<T> { @InsertProvider(type = BaseProvider.class, method = "batchInsert") int batchInsert(@Param("lists") List<T&gt

小楼夜听雨的博客 2420

poj1018(动规)

poj1018:http://poj.org/problem?id=1018 通过此题,我学到: 1.该题目给出了设备种类的范围,没给出设备带宽的范围,因为它是个离散量,打表尝试,500可以,400报错 2.dp[ ][ ],行标表示设备号,列标表示带宽号,值表示最小价格,第一行要初始化 对于每一个设备i的当前厂商给出的带宽b和价格p,要搜索之前的i-1个设备的所有带宽,比较: 2.1若...

GooTal的博客 462

innovus:给channel加soft blockage

dbGet [dbGet top.fplan.pBlkgs.name finishfp_place_blkg_* -p].boxes就可以获得channel坐标。意思是给30um以下的channel加soft blk,至于channel的坐标,通过抓取该soft blk去获取,比较容易。工具自己加入的placement blockage命名上叫finishfp_place_blkg_*ICC2中有给channel自动加soft blockage的命令,相应的innovus也有类似的命令,我们可以使用。

m0_61544122的博客 492

华为HCIP的学习大纲和计划

HCIP(华为认证 ICT 高级工程师)核心围绕华为 ICT 技术体系,不同方向(如路由交换、云计算、安全等)课程目录不同,以下是最热门的。

迷逝 589

poj1018 java_POJ1018Communication System题解动态规划DP | 学步园

Communication SystemTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 12607Accepted: 4377DescriptionWe have received an order from Pizoor Communications Inc. for a special communication system....

weixin_35890888的博客 186

xilinx原语及bank简介

图8是HP bank与HR bank的IO模块,其中PAD是FPGA的金属管脚,IOB是输入、输出引脚的控制模块。此时使用原语就可以只调用需要的组件,不需要去考虑其余组件参数设置,就方便很多,借助此次机会就对IDDR、ODDR、IDELAYE2、ODELAYE2、IDELAYCRTL、ISERDESE、OSERDESE等几个原语做了简要了解,并对原语的各个模式进行了仿真,本文最初是介绍IDDR的,但在介绍IDDR这些原语之前,还需要了解一下7系列FPGA bank的分类和区别,所以就有了本文。

qq_43416206的博客 421

POJ1018-Communication System

全解题报告索引目录 -> 【北大ACM – POJ试题分类】 转载请注明出处:http://exp-blog.com ------------------------------------------------------------------------- 这里提供两种解题思路:DP 和 枚举。 以下是DP的解题方式(2017新增): /* ...

ζёСяêτ - 小優YoU 3万+

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【dp】poj 1018 Communication System

/* poj 1018 Communication System 题意:在n行里,每行里有mi个运输机,从一行选择一个,最后算得选择的运输机min(B)/sum(P),使之最大。 题解: dp[i][j]代表前i行,min(B)为j的最小花费钱。 注意有意义的j个数是变化的。 if(b[i] >= j) dp[j] = min(dp[j],ans+p[i]); else dp[b[

学无纸巾 254

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

POJ 1018:Communication System - DP

POJ 1018 题意: 某公司要建立一套通信系统,有n个厂家提供生产所需要的网线。而每个厂家生产的同种网线都会存在两个方面的差别:带宽bandwidths 和 价格prices。 现在需要在每个厂家选择一件网线,考虑到性价比问题,要求所挑选出来的n件设备,要使得B/P最大。输出这个比值保留3位小数。(其中B为这n件设备的带宽的最小值,P为这n件设备的总价。)思路: dp[i][j]:取到第 i

Booky的专栏 618

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Communication System POJ1018(动态规划)

Communication SystemPOJ - 1018 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...

勉強しているユキさんです 560

POJ1018 - Communication System 解题报告

POJ1018 - Communication System 解题报告原题解析题目要点贪心dp示例代码贪心dp 原题解析 题目说提供 t [1, 10] 个 case 。 每个 case 包括 n [1, 100] 个设备。 每个设备包括 i [1, 100] 个备选制造商提供的不同设备。 每个设备包括两个属性,带宽 b ,价格 p 。 题目要求每一个设备都要选择使用一个对应制造商提供的设备使得整个网络的带宽性价比最高。 其中,整体网络的带宽等于所有设备中的最小带宽,整体网络的价格等于所有设备价格的总和。

oneCertain的博客 224

poj 1018 Communication System

题意: 某公司要建立一套通信系统,该通信系统需要n种设备,而每种设备分别可以有m1、m2、m3、...、mn个厂家提供生产,而每个厂家生产的同种设备都会存在两个方面的差别:带宽bandwidths 和 价格prices。 现在每种设备都各需要1个,考虑到性价比问题,要求所挑选出来的n件设备,要使得B/P最大。 其中B为这n件设备的带宽的最小值,P为这n件设备的总价。

大神养成中..... 9759

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 ma...

名字呢? 408

POJ 1018 Communication System

这道题跟那天做到的jury很像,第一感觉是开dp,dp[i][j],j参数记录题目要求的B P的其中一个,然后dp[i][j]的值来表示另外一个。当时觉得最后算max(Bmin/Psum)的时候还需要再开一个path[][]记录路径。开始写之后发现其实用不到。 dp的核心还是在于当前状态与“上一”状态的关系,换句话说真正用得到的就只有两个状态。这里虽然看起来每次都要比较min{b1,b2,b3,b...

CarpeDiem 185

POJ 1018 Communication System(动态规划)

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 their max

风的记忆 510

POJ1018 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 m...

邵光亮的博客 593

POJ #1018 Communication System

简单dp题,0-1背包模型。定义d[i][j]表示考虑完前i个设备,最大bandwidth为j时的最小费用。bandwidth的范围题目中没说,但貌似不大(500以内) #define UVa "poj-1018.cpp" //Communication System char fileIn[30] = UVa, fileOut[30] = UVa; #include #inclu

专攻挖掘机炒鸡蛋算法的专栏 826

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

AK_HuangYC的博客 501

poj1018Communication System dp

//一个系统需要n个设备,每个设备有不同的生产厂家,不同的厂家的设备的性能和价格不同 //现在问要这个系统的B/P的最大值,B是N个设备性能最差的性能,P是n个设备的价格 //dp[i][j] 表示前i个设备的性能大于等于j的最少价格 #include<cstdio> #include<cstring> #include<iostream> using namespace std ; const i

ijbuhv的专栏 904
上一篇: 多重背包中多次背包 O(VN) 算法 (线性动规) 带参考程序
下一篇: POJ1260Pearls题解动态规划DP
power721
博客等级 码龄19年 176粉丝 135原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值