#K601. Total Profit Calculation for Taco Sales
Total Profit Calculation for Taco Sales
Total Profit Calculation for Taco Sales
In this problem, you are given the sales data for a Taco company over several days. For each test case, you are provided with the number of days (N), the cost price per pack (C), the selling price per pack (S), and the number of packs sold each day. Your task is to compute the total profit over (N) days. The profit for a test case is calculated as follows:
[ \text{Profit} = \left(S - C\right) \times \left(\sum_{i=1}^{N} {\text{packs}_{i}}\right) ]
Note that if the selling price is equal to the cost price, the profit will be zero. Use standard input and output for handling data.
inputFormat
The first line of input contains an integer (T) representing the number of test cases. For each test case, the first line contains three integers: (N) (the number of days), (C) (the cost price per pack), and (S) (the selling price per pack). The next line contains (N) space-separated integers, representing the number of packs sold on each day.
outputFormat
For each test case, output a single line containing the total profit.## sample
2
3 100 150
10 20 30
4 90 120
5 5 10 5
3000
750
</p>