#K47877. Minimum Delivery Cost
Minimum Delivery Cost
Minimum Delivery Cost
You are given T test cases. Each test case describes the delivery plan for a number of cities. For each city ( i ) (where ( 1 \leq i \leq N )), you are given the number of packages ( P_i ) that need to be delivered and a cost ( C_i ) for delivering a single package. The goal is to compute the minimum total cost to deliver all the packages in each test case. In mathematical notation, for each test case, the total cost is given by:
[ \text{Total Cost} = \sum_{i=1}^{N} P_i \times C_i ]
Output the computed total cost for each test case on a separate line.
inputFormat
The input is given via standard input (stdin). The first line contains an integer ( T ) representing the number of test cases. For each test case:
- The first line contains an integer ( N ), the number of cities.
- The second line contains ( N ) space-separated integers representing the list ( P ), where ( P_i ) is the number of packages for the ( i )-th city.
- The third line contains ( N ) space-separated integers representing the list ( C ), where ( C_i ) is the cost of delivering a package to the ( i )-th city.
outputFormat
For each test case, output a single line containing the minimum total delivery cost as an integer.## sample
2
3
10 20 30
6 2 4
2
5 8
3 5
220
55
</p>