Submit | All submissions | Best solutions | Back to list |
HS11INV2 - Another Investment |
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.
Input
The 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.
Output
Output 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
Scoring
By solving this problem you score 10 points.
Added by: | kuszi |
Date: | 2011-09-05 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League |