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. 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 highest price we 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 (≤105), the total number of the members in the supply chain (and hence they are numbered from 0 to N−1); P, the price given by the root supplier; and r, the percentage rate of price increment for each distributor
供应链价格传递与最高售价计算

该代码实现了一个计算供应链中最高零售价的算法。从根供应商开始,每个成员以比供应商价格高r%的价格购买并销售产品。给定供应链的成员数量、初始价格P和价格增长百分比r,程序通过深度优先搜索遍历供应链,找出最高的预期售价及出售该价格的零售商数量。
最低0.47元/天 解锁文章
317

被折叠的 条评论
为什么被折叠?



