Submit | All submissions | Best solutions | Back to list |
EIURETIRE2 - Retirement 2 |
Quynh has recently launched a new business, and it’s thriving. She now wants to plan for her financial freedom. Here are the details:
- Quynh estimates her income for the next N months as Mi, where i ranges from 0 to N-1.
- After receiving her monthly profit, Quynh spends X USD on expenses. The monthly expenses increase according to an annual inflation rate of f%.
- Quynh invests the surplus amount each month with an annual interest rate of r%.
- Her goal is to accumulate enough money to sustain her lifestyle for the next 100 years (1200 months from starting her work)
Help Quynh calculate the maximum initial amount X0 (in USD) that Quynh may spend.
Input:
- The first line contains three values: N (number of months of work), r% (annual interest rate), and f% (annual inflation rate).
- The second line consists of N space-separated values representing Quynh’s monthly salary: Mi for i = 0, 1, …, N-1.
Output:
Print the value of X0. The result is rounded down in units.
Sample
Input |
Output |
12 5.2 3.6 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 |
1952 |
10 3 2 119879 251746 396800 556359 731874 924940 1137313 1370924 1627895 1910564 |
11701 |
Added by: | Ha Minh Ngoc |
Date: | 2024-06-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |