博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1106 Lowest Price in Supply Chain (25)
阅读量:4670 次
发布时间:2019-06-09

本文共 2292 字,大约阅读时间需要 7 分钟。

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.003 2 3 51 91 41 702 6 11 8000

Sample Output:

1.8362 2
1 #include
2 #include
3 #include
4 using namespace std; 5 vector
num(100002, 0); 6 vector
> v; 7 int minn=99999999; 8 void dfs(int root, int depth){ 9 if(v[root].size()==0){10 num[depth]++;11 if(depth
>n>>p>>r;19 v.resize(n);20 for(i=0; i
>k;23 for(j=0; j

 

转载于:https://www.cnblogs.com/mr-stn/p/9160742.html

你可能感兴趣的文章
Window 分布式学习-好文收藏
查看>>
Android TextUtils类介绍
查看>>
linux echo设置颜色
查看>>
英文参考文献标准格式:论文参考文献格式规范(转载)
查看>>
css div框加小箭头
查看>>
Eclipse快捷键与使用技巧总结
查看>>
Solr4.8.0源码分析(16)之SolrCloud索引深入(3)
查看>>
PEP8 - Python编码规范
查看>>
div放置图片总结
查看>>
FZOJβ #45. 染色问题
查看>>
Python之SYS模块
查看>>
webapi文件上传和下载
查看>>
HDU 1540 Tunnel Warfare [二分 + 线段树]
查看>>
C++:构造函数和析构函数能否为虚函数
查看>>
win7便笺元数据损坏,最新解决办法
查看>>
mongod
查看>>
vim配置python高亮和缩进
查看>>
Spring3.0.5 获取表中自增的主键(mysql)
查看>>
delphi dxBarManager 的dxBarEdit 输入问题
查看>>
Hadoop入门介绍一
查看>>