#K15481. Calculate Total Data Usage
Calculate Total Data Usage
Calculate Total Data Usage
You are given the data usage records of N customers over D days. For each customer, you need to compute the total data usage by summing up the usage over all days.
The data usage for the i-th customer can be calculated using the formula:
\( total\_usage_i = \sum_{j=1}^{D} usage_{ij} \)
The program should read the input from stdin
and print the results to stdout
, where each line of the output contains the customer id (starting from 0) followed by their total usage, separated by a space.
inputFormat
The first line of the input contains two integers N and D, representing the number of customers and the number of days respectively.
This is followed by N lines, each containing D integers. The j-th integer on the i-th line represents the data usage of customer i on day j.
Read the input from stdin
.
outputFormat
For each customer, output a line containing two integers: the customer id and their total data usage. The output should be printed to stdout
with each line formatted as:
customer_id total_usage
3 4
1 2 3 4
2 3 4 5
3 4 5 6
0 10
1 14
2 18
</p>