1106 Lowest Price in Supply Chain (25 分)

如何在OBS中添加实时时间戳:Lua脚本配置教程(附效果展示) 本文详细介绍了如何在OBS中通过Lua脚本配置实时时间戳功能,包括环境准备、脚本获取、安装配置及高级定制。适用于直播和视频录制场景,提供精准回溯和风格自定义,支持多平台适配和性能优化,是专业制作的必备技巧。 阅读详情

在这里插入图片描述
1106 Lowest Price in Supply Chain (25 分)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.

Starting from one root supplier, everyone on the chain buys products from one’s supplier in a price P and sell or distribute them in a price that is r% higher than P. Only the retailers will face the customers. It is assumed that each member in the supply chain has exactly one supplier except the root supplier, and there is no supply cycle.

Now given a supply chain, you are supposed to tell the lowest price a customer can expect from some retailers.

Input Specification:
Each input file contains one test case. For each case, The first line contains three positive numbers: N (≤10
5
), the total number of the members in the supply chain (and hence their ID’s are numbered from 0 to N−1, and the root supplier’s ID is 0); P, the price given by the root supplier; and r, the percentage rate of price increment for each distributor or retailer. Then N lines follow, each describes a distributor or retailer in the following format:

K
i
​
ID[1] ID[2] … ID[K
i
​
]

where in the i-th line, K
i
​
is the total number of distributors or retailers who receive products from supplier i, and is then followed by the ID’s of these distributors or retailers. K
j
​
being 0 means that the j-th member is a retailer. All the numbers in a line are separated by a space.

Output Specification:
For each test case, print in one line the lowest price we can expect from some retailers, accurate up to 4 decimal places, and the number of retailers that sell at the lowest price. There must be one space between the two numbers. It is guaranteed that the all the prices will not exceed 10
10
.

Sample Input:
10 1.80 1.00
3 2 3 5
1 9
1 4
1 7
0
2 6 1
1 8
0
0
0
Sample Output:
1.8362 2

#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
using namespace std;
vector<int> ID[100005];
int mindepth = 100005;
int minnum = 1;
void dfs(int N, int depth) {
	if (depth > mindepth) return;
	if (ID[N].size() == 0) {
		if (mindepth == depth) minnum++;
		else if (depth < mindepth) {
			mindepth = depth;
			minnum = 1;
		}
	}
	for (int i = 0; i < ID[N].size(); i++)
		dfs(ID[N][i], depth + 1);
}
int main() {
	int N;
	double P, r;
	cin >> N >> P >> r;
	for (int i = 0; i < N; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int temp;
			cin >> temp;
			ID[i].push_back(temp);
		}
	}
	dfs(0, 0);
	cout << fixed << setprecision(4) << P * pow(1 + r / 100, mindepth);
	cout << " ";
	cout << minnum;
	return 0;
}
C++和OpenGL实现3D游戏编程【连载7】——文字和汉字的显示(附源码) 上一节我们讨论了纹理在二维平面内不规则图形贴图的相关基础操作,本节我们开始了解游戏里文字以及汉字的显示方法。本节课我们将从基本的ASCII字符显示,拓展到中文字符的显示,最后再讲到纹理字符的显示,并对各种文字显示方法的优缺点和使用场景进行分析,这节课将使用到显示列表、兼容视图、屏幕图形转纹理等操作。 阅读详情

相关推荐

STM32F103串口接收中断:USART_IT_IDLE和USART_IT_RXNE区别

2:如果是大于1个byte的数据,在不用DMA的情况下,同时使能USART_IT_RXNE,USART_IT_IDLE中断,每收到一个字节在中断中把数据存到缓存中,待收到USART_IT_IDLE中断时,收完整帧数据,然后再解析处理数据。比如:如上图在初始化时,同时开启了两个中断,如果传送8个字节的数据,就会产生8个USART_IT_RXNE,和1个USART_IT_IDLE中断。(如果接收到数据,在1个byte的时间内,没有收到新数据,就认为是数据传送完成,产生空闲USART_IT_IDLE中断)

weixin_66299220的博客 2401

1106 Lowest Price in Supply Chain(25 分)

1106 Lowest Price in Supply Chain(25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starti...

galesaur_wcy 633

[原创]Linux 802.11n CSI tool Monitor模式

Linux 802.11n CSI tool Monitor模式 使用AP模式的缺陷在于ping 命令速度比较慢,且不能精确控制发送的参数,比如接收的包数量是不可控的。Monitor模式可以调制发送速率、发包数量、发送天线个数、HT模式、short/long guard interval等等,因此调通Monitor模式是必须的。期间参考了博主沃一德的CSI Tool安装使用讲解,对他的工作表示感...

u014645508的博客 1万+

【PAT甲级】1106 Lowest Price in Supply Chain (25分)

解题过程的小记录,如有错误欢迎指出。 难度:三星(在做完1012后弄懂排序规则后此题并不难) 小导航~题目分析注意点我的解题过程思路bug代码dalao的代码借鉴点 题目分析 销售链问题,用DFS解的话这题就是求最小深度,以及该深度上的叶子个数 注意点 根在哪里需要自己找 用DFS时,root为第0层,因为第0层是供应商,是原价 我的解题过程 思路 构建树,因为本题不需要用到结点的数据域,所以直接开一个vector数组用于存储每个结点的孩子即可 写DFS函数,找出深度最浅的叶子结点和其个数(深度最浅的

SpicyChicken的自我修养 356

用STM32F103单片机控制电调制动无刷电机

用电调控制无刷电机制作遥控飞艇 蓝牙控制 调控电调 无刷电机 用电调控制无刷电机制作遥控飞艇 代码区 mian.c #include "delay.h" #include "sys.h" #include "usart.h" #include "usart3.h" #include "timer.h" #include "led.h" #include "key.h" int main(v...

子非鱼 的博客 2万+

步进电机驱动算法——梯形加减速算法

目录步进电机梯形加减速梯形加减速算法原理分析算法实现 步进电机梯形加减速 电机的控制方式一般分为开环控制与闭环控制两种控制方式,其中开环控制原理框图如下: 这种种控制方式的特点是:控制简单、实现容易、价格较低,这种开环控制方式,负载位置对控制电路没有反馈。 对于步进电机,控制脉冲的输入并不依赖于转子的位置,而是按一固定的规律发出控制脉冲,如果励磁变化太快,电机不能移动到新的位置,那么实际负载位置与理想位置就会产生一个偏差,就有可能出现失步或者过冲现象,所以需要使用加减速算法。 梯形加减速算法,S加减速算法等

aaa376070331的博客 3万+

[PAT-A 1106]Lowest Price in Supply Chain

考察树的遍历 题目大意: 给出一颗销售供应的树,树根唯一,在树根处货物的价格为P,然后从根节点每往孩子走一层,该层的货物价格会在父亲节点的价格上增加r%,求叶子节点能获得的最低价格以及能提供最低价格的叶子节点的个数。 思路: 1.实质上是求深度最小的叶子节点 2.思想类似于[PAT-A 1079]Total Sales of Supply Chain,在处理叶子节点的时候开一个全局变量num,记...

RegulusF的博客 264

从LLM到VLM再到VLA:三兄弟的“变形记”——定义、架构演进与最新趋同

LLM、VLM、VLA虽然在时间上依次出现,但它们在架构上的演进并非线性替代,而是形成了一个从“理解语言”到“理解世界”再到“改变世界”的认知闭环。VLA之所以能在短短三年内从概念走向现实,正是因为它站在了LLM和VLM的肩膀上——RT-2的泛化能力来自互联网规模的VLM预训练,π0的扩散策略受益于生成式模型的突破,Helix的双系统架构借鉴了“快慢思考”的认知科学洞见。而反过来,VLA在实际部署中遇到的效率瓶颈和实时性要求,也在倒逼LLM和VLM向更轻量、更高效的架构方向演进。

Ven%的博客 490

1106. Lowest Price in Supply Chain (25)-PAT甲级真题(dfs,bfs,树的遍历)

1106. Lowest Price in Supply Chain (25) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Star

柳婼 の blog 2159

【AI大模型】角色设定:给模型定身份的高效使用方法

摘要: AI大模型角色设定(RolePrompting)是提示词工程的核心优化技巧,通过赋予模型特定职业、领域和风格约束,显著提升输出专业度与适配性。文章系统拆解了角色设定的原理、万能公式(领域+身份+技能+风格+场景)、三级分层写法(基础/进阶/专家),并提供10类高频场景的模板。通过无角色与有角色输出的对比实验(Python代码量化验证),证明角色设定可使模型综合得分提升35%以上,尤其优化场景适配度与风格统一性。该技巧作为高阶提示词(如CoT、Few-Shot)的前置模块,能以零成本实现AI输出的专业

unber的博客 43

基于YOLOv11的手术器械计数系统:从数据集构建到Web应用部署

m2cai16-tool数据集:包含15种腹腔镜手术器械的标注图像Cholec80数据集:包含80个胆囊切除手术视频,标注了7种器械SurgicalTools数据集:包含超过10,000张手术器械图像,涵盖21类常见器械手术剪(Scissors)止血钳(Hemostat)持针器(Needle Holder)手术刀(Scalpel)镊子(Forceps)拉钩(Retractor)吸引器(Suction)

YOLO 396

【PAT甲级A1090】Highest Price in Supply Chain (25分)(c++)

1090 Highest Price in Supply Chain (25分) 作者:CHEN, Yue 单位:浙江大学 代码长度限制:16 KB 时间限制:200 ms 内存限制:64 MB A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Start

小庄同学的博客 225

三相五柱式消弧线圈自动测控装置设计与实现

本文设计了一种基于STM32的三相五柱式消弧线圈自动测控装置。该装置采用信号注入法检测系统对地电容电流,通过PID自适应算法调节消弧线圈电感值,实现单相接地故障时的快速补偿。硬件系统包含信号采集、注入、控制执行等模块,软件采用Goertzel算法提取特征频率信号,结合增量式PID实现精确控制。实验结果表明,装置电容检测误差小于2%,调谐响应时间小于50ms,满足配电网对消弧线圈自动调谐的技术要求。

AI的内部世界的博客 239

1106 Lowest Price in Supply Chain (25分)

1 题目 1106 Lowest Price in Supply Chain (25分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Sta...

韩江雪de 小屋 678

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

【1106】Lowest Price in Supply Chain (25 分)

#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #inclu...

发现问题,并解决问题,批判性思维 774

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

1106 Lowest Price in Supply Chain (25 分)

1106 Lowest Price in Supply Chain (25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Start...

acm_zh的博客 314

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

dfs_1106 Lowest Price in Supply Chain (25 分)

目录 1106 Lowest Price in Supply Chain 题目描述 解题思路 程序 1106 Lowest Price in Supply Chain 题目描述 A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved...

A_Bo的博客 563

1106 Lowest Price in Supply Chain (25 分)

1106Lowest Price in Supply Chain(25分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Start...

chen_zan_yu_的博客 164

甲级1106 Lowest Price in Supply Chain (25 分)

1106 Lowest Price in Supply Chain (25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Startin...

weixin_44751612的博客 205
上一篇: 1004 Counting Leaves (30 分)
下一篇: 1094 The Largest Generation (25 分)
好想当依蕾娜小姐的狗
博客等级 码龄7年 0粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值