← Back to Problems
The Uniform Call
Easy standard Pricing
Time limit: 1 s per test  ·  Memory: 256 MB

Under the risk-neutral measure, a stock's price at expiry T is uniformly distributed on [a, b]. The continuously compounded risk-free rate is r.

Compute the price of the European call with strike K and expiry T.

Input

Five numbers a, b, K, r and T.

Output

One real number: the call price, with absolute or relative error at most 1e-9.

Constraints

0 <= a < b <= 10^4

0 <= K <= 1.5 * 10^4

-0.05 <= r <= 0.1

0.001 <= T <= 30

Scoring

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 a relative tolerance of 1e-09 of the expected value.

Examples

input
80 120 100 0.02 1
output
4.900993366534e+00
input
100 200 50 0.05 2
output
9.048374180360e+01
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2
Discussion
No comments yet. Kick off the discussion.