#K38137. Count Groups
Count Groups
Count Groups
In this problem, you are given n departments and the number of employees in each department. Your task is to count the number of ways to form a group by selecting exactly one employee from each department.
Mathematically, if the number of employees in the departments are given by \(A_1, A_2, \ldots, A_n\), then the total number of ways to form the group is given by:
\(\prod_{i=1}^{n} A_i\)
Input: The first line contains a single integer n (1 ≤ n ≤ 20), representing the number of departments. The second line contains n space-separated integers, where the i-th integer represents the number of employees in the i-th department.
Output: Output a single integer – the product of these n numbers.
inputFormat
The input consists of two lines. The first line contains an integer n (1 ≤ n ≤ 20), the number of departments. The second line contains n space-separated integers, where the i-th integer denotes the number of employees in the i-th department.
outputFormat
Output a single integer which is the product of the n numbers, representing the number of ways to form a group by choosing one employee from each department.## sample
3
2 3 4
24
</p>