#C913. Daily Sales Statistics
Daily Sales Statistics
Daily Sales Statistics
You are given a set of sales records. Each record contains a sale date and a quantity of products sold on that day. Multiple records may belong to the same day. Your task is to compute the total sales for each day, then find the average, minimum, and maximum daily sales.
Let \( S_d \) be the total sales on day \( d \). If there are \( k \) distinct days, then you need to compute:
- \( \text{Average} = \frac{\sum_{d=1}^{k} S_d}{k} \)
- \( \text{Minimum} = \min\{S_d\} \)
- \( \text{Maximum} = \max\{S_d\} \)
If there is no sales record, output None
for all three values.
inputFormat
The input is read from standard input (stdin) and has the following format:
N sale_date1 quantity1 sale_date2 quantity2 ... sale_dateN quantityN
Where:
N
is an integer representing the number of sales records.- Each record consists of a sale date in YYYY-MM-DD format and an integer quantity.
- If
N
is 0, there are no records.
outputFormat
The output should be printed to standard output (stdout) in a single line with three values separated by a space:
average min max
The average must be printed as a floating point number rounded to one decimal place. If there are no records, output None None None
.
6
2023-09-01 10
2023-09-01 15
2023-09-02 20
2023-09-03 5
2023-09-03 25
2023-09-03 30
35.0 20 60