|
|||||||||||||||||||
|
SPOJ time: 2012-05-25 02:29:11 |
Another InvestmentProblem code: HS11INV2
In n successive years Robert made n investments, one per year. Now, he would like to verify how effective his investments were and to calculate the annualized rate of return for them. InputThe first line of input contains one integer 1< n <10 - the number of years to be considered. In the next n lines you are given the amount (with two digits of precision) of Robert's investment in each of the consecutive years – one amount in each line. The last line contains one number: Y>0 - the total value of all of Robert's investments after n years, with two digits of precision. OutputOutput the internal rate of return (IRR), assuming that annual investment period lengths were equal, as a percentage value with two digits of precision. Example 1 Input: 4 1000.00 1000.00 1000.00 1000.00 7000.00 Output: 23.69 Example 2 Input: 3 3 2 2 3 Output: -34.63 ScoringBy solving this problem you score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||