#C10190. Dice Sums
Dice Sums
Dice Sums
Given n dice where the ith die has fi faces, determine the minimum and maximum possible sums when each die is rolled exactly once. Each die produces an integer outcome from 1 up to its number of faces. Thus, the minimum sum is achieved when every die shows a 1, i.e. $$min\_sum = n$$, and the maximum sum is given by the sum of the number of faces of each die, i.e. $$max\_sum = \sum_{i=1}^{n} f_i$$.
Input/Output: The problem is to be solved with input read from standard input (stdin) and output printed to standard output (stdout). The input will provide the number of dice, followed by the list of faces for each die. The result should be output as two space-separated integers representing the minimum and maximum possible sums.
Examples:
- Input:
3
6 8 4
Output:3 18
- Input:
2
12 20
Output:2 32
inputFormat
The first line contains an integer n
, representing the number of dice. The second line contains n
space-separated integers, where the ith integer represents the number of faces on the ith die.
outputFormat
Output two space-separated integers: the minimum sum and the maximum sum that can be obtained by rolling the dice once each.
## sample3
6 8 4
3 18
</p>