Compounding Growth Factors
Halcyon Bank's fund reports track a holding by its daily growth factor rather than by its price. A factor of 1.05 means the holding gained five percent that day, 1.0 means it held steady, and 0.9 means it lost a tenth. The report needs a second row underneath: what a holding worth exactly 1 at the start of the period would be worth at the end of each day. Because each day's growth applies to what the holding is already worth, the days pile onto one another rather than adding up.
Task: Print what an opening value of 1 would be worth at the end of each day.
Input
The first line holds a single integer n, the number of days. Each of the next n lines holds one day's growth factor, a positive decimal.
Output
One line holding n values, in day order, separated by single spaces, each with exactly four digits after the decimal point. The first value is the first day's factor itself.
Example:
Input:
3
1.1
1.0
0.9
Output:
1.1000 1.1000 0.9900
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in