An account earns an annual rate r, compounded n times per year. Each compounding event also incurs a tiny rebalancing friction, so one dollar grows by the factor
1 + r/n - c/n^2
per period, where c > 0 is a fee parameter. As the rebalancing frequency n grows, the account approaches its continuous limit. Compute the value of one dollar after t years in that limit:
L = lim (1 + r/n - c/n^2)^(n t) as n -> infinity
Three numbers r, c and t, each given with at most 6 digits after the decimal point.
Output L with absolute or relative error at most 1e-9.
0.001 <= r <= 10
0 <= c <= 1000
0.01 <= t <= 20
r * t <= 50
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
Numeric answers are accepted if they are within an absolute tolerance of 1e-09 or a relative tolerance of 1e-09 of the expected value.
0.05 1 1
1.051271096376024e+0
0.1 0 2
1.221402758160170e+0