#K49412. Flower Heights After Days
Flower Heights After Days
Flower Heights After Days
You are given f flowers, each with a specified growth factor, and an integer D representing the number of days. Initially, each flower has a height of 1. After D days, the final height of each flower becomes:
\(\text{height} = g^D \pmod{10^9+7}\)
where \(g\) is the growth factor of the flower and the modulo is taken with \(10^9+7\). Your task is to calculate the final heights of all flowers and output them in a single line separated by a space.
inputFormat
The input is given from stdin and consists of two lines:
- The first line contains two integers
f
andD
separated by space, wheref
denotes the number of flowers andD
denotes the number of days. - The second line contains
f
space-separated integers representing the growth factors of the flowers.
outputFormat
Output to stdout a single line containing f
integers. Each integer represents the final height of the corresponding flower modulo \(10^9+7\), separated by a space.
3 2
2 3 4
4 9 16
</p>