PAT A 1079(甲级)

这道PAT甲级题目要求计算从零售商到顾客的供应链总销售额。每个成员从供应商处以价格P购买,并以P的(r%)加价出售。零售商面对客户,每个成员只有一个供应商,没有循环供应。输入包括成员总数、根供应商的价格P和价格增加率r%,输出所有零售商的总销售额,保留1位小数。解题思路是深度优先遍历。提供的AC代码中需要注意将r转换为小数进行计算。
摘要由CSDN通过智能技术生成

1079 Total Sales of Supply Chain(25 分)

作者: CHEN, Yue

单位: 浙江大学

时间限制: 250 ms

内存限制: 64 MB

代码长度限制: 16 KB

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 total sales from all the retailers.

Input Specification:

Each input file contains one test case. For each case, the first line contains three positive numbers: N (≤

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值