| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
大家看看怎么做?Build Channels Time Limit:1000MS Memory Limit:65536K Description Some villagers inhabit beside a mountain,they have built a reservoir. Now they want to lead the water from the reservoir to their field. Suppose the reservoir is above the channels and the channels are at the same level; all the fields are below the channels. But because each channel has different width, they have different current when the water goes through them. When the reservoir is open, the water will come out of it and go to the fields through the channels. Some channels will branch at someplace, and the flux of each branch is in direct proportion to his width. Input First line of input is an integer n, the number of cases for the test data. First line of each case contains three integers: u, v and r, where u is the number of places that have branches and numbered from 1 to 100; v is the number of fields to be filled and numbered from 101 to 200; r is the number of branches from reservoir to the fields. 0 represents the reservoir. The following r lines are the description of the branches, it contains three integers: i, j and k, which represents a branch from place i to j and its flux is k (k cubic per hour). The last line of each case contains a few integers which are separated by a space, the first one of them is the amount of water (unit: cubic) comes out of the reservoir once the reservoir is open, and the others represent the fields to be filled. Output Output the amount of water to be filled to the specified fields, each case contains a line. Output should be printed with two digits after the decimal points and separated by a space. Sample Input 1 4 2 9 0 1 2 0 3 3 0 2 5 1 102 8 1 4 2 2 3 1 3 101 2 3 4 2 4 102 10 1000 101 102 Sample Output 400.00 600.00 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator