#K68027. Cake Combinations
Cake Combinations
Cake Combinations
Given a number of available cake flavors and a maximum number of layers, determine the total number of distinct cakes that can be created. Each cake consists of exactly L layers, and each layer can be filled with any of the available F flavors independently. Hence, the number of distinct cakes is given by the formula: \(F^{L}\).
Note: Although a list of flavor names is provided for each test case, it does not affect the computation.
inputFormat
The input consists of multiple datasets. Each dataset is described by two lines:
- The first line contains two integers F and L (1 ≤ F, L ≤ 10), where F is the number of available flavors and L is the maximum number of layers.
- The second line contains F space-separated strings representing the names of the flavors (this line is not used in the computation).
The input terminates with a line containing "0 0".
outputFormat
For each dataset, output a single integer representing the number of distinct cakes that can be created, each on a new line.
## sample3 2
a b c
4 3
a b c d
2 2
x y
0 0
9
64
4
</p>