#C3430. Maximizing Data Transfer

    ID: 46857 Type: Default 1000ms 256MiB

Maximizing Data Transfer

Maximizing Data Transfer

In this problem, you are given several test cases. In each test case, there are a number of devices. Each device has a specific data transfer rate and an operating time. Your task is to calculate the maximum amount of data that can be transferred, which is computed by summing the product of the data transfer rate and the operating time for each device.

The formula for the total amount of data transferred in a test case is given by:

\(\text{Total Data} = \sum_{i=1}^{N}(\text{rate}_i \times \text{time}_i)\)

You will be given the number of test cases, and for each test case, the number of devices followed by two lines: one for the data transfer rates and one for the operating times. Print the computed result for each test case on a new line.

inputFormat

The input is provided via standard input (stdin) and follows this format:

T
N
rate_1 rate_2 ... rate_N
time_1 time_2 ... time_N
... (repeated for T test cases)

Where:

  • T is the number of test cases.
  • For each test case, the first line contains an integer N indicating the number of devices.
  • The second line contains N space-separated integers representing the data transfer rates.
  • The third line contains N space-separated integers representing the operating times.

outputFormat

For each test case, output the total amount of data transferred on a separate line. The output is produced via standard output (stdout).

The result for each test case is computed using the formula:

\(\text{Total Data} = \sum_{i=1}^{N}(\text{rate}_i \times \text{time}_i)\)

## sample
1
3
10 20 30
1 2 3
140

</p>