{"problem":{"name":"132. Code RAMs","description":{"content":"You have a function $f (x)$, and you want to figure out how the area under $f (x)$ from 0 to $C$.  In calculus, this value is called the $i n t e g r a l$ of $f (x)$. For some functions, taking its i","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":10000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269132"},"statements":[{"statement_type":"Markdown","content":"You have a function $f (x)$, and you want to figure out how the area under $f (x)$ from 0 to $C$. \n\nIn calculus, this value is called the $i n t e g r a l$ of $f (x)$. For some functions, taking its integral is relatively easy and uses a few simple rules. However, for many functions, it is impossible to find their integral exactly. However, you can make an approximation of the integral, and since you're writing a computer program, you can make a close approximation.\n\nOne way to approximate the integral of a function is to use the Rectangular Approximation Method, or RAM. This method approximates the function $f (x)$ as $n$ rectangles, each having an equal width, and having varying $y$-values depending on the value of $f (x)$ at that point. \n\nAs you can see, the example with $n$=4 ($f (x)$ was divided into four rectangles) was not perfect. However, as $n$ gets larger and larger, the approximations get more and more accurate.\n\nFormally, define the LRAM (Left Rectangular Approximation Method) approximation of the area under a function $f (x)$ from $0$ to $C$, using $n$ rectangles, as A, and the area of each rectangle as A1, A2 ... AN, as the following:\n\nA = $frac(A 1 * C, N)$ + $frac(A 2 * C, N)$ + $frac(A 3 * C, N)$+ ... + $frac(A N * C, N)$.\n\nThe area of each rectangle can be calculated using the standard formula A = $l$ x $w$. The width of each subrectangle is equal to $frac(C, n)$ (because there are $n$ rectangles with a total width of $C$). The length of each subrectangle is equal to $f (frac(k * c, n))$, where $k$ represents the index of the rectangle, ranging from $0$ to $n -1$, inclusive.\n\nSince your answer must be a relatively close approximation, but your program should fit inside of the 10 second time limit (longer than usual for this problem), you should *set $N$ equal to 50000*.\n\nThe only line of input contains a calculus equation. The equation will consist of the variable $x$, exponents, parentheses, and multiplication, division, addition, and subtraction operations. For example, $frac(x^2 -3, x^3 -x + 5)$ would be a valid input, but $c o s (x)$ would be not.\n\nOutput a single decimal number: the area under $f (x)$ from $x$=$0$ to $x$=$C$. Your number should be close to the actual answer, but it doesn't have to be exact. *Using eval() or similar commands in your program is not allowed.*\n\nIn the first sample case, $6. 663$ would be judged as correct, but $7$ would be judged as incorrect.\n\n## Input\n\nThe only line of input contains a calculus equation. The equation will consist of the variable $x$, exponents, parentheses, and multiplication, division, addition, and subtraction operations. For example, $frac(x^2 -3, x^3 -x + 5)$ would be a valid input, but $c o s (x)$ would be not.\n\n## Output\n\nOutput a single decimal number: the area under $f (x)$ from $x$=$0$ to $x$=$C$. Your number should be close to the actual answer, but it doesn't have to be exact. *Using eval() or similar commands in your program is not allowed.*\n\n[samples]\n\n## Note\n\nIn the first sample case, $6. 663$ would be judged as correct, but $7$ would be judged as incorrect.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ f: \\mathbb{R} \\to \\mathbb{R} $ be a rational function defined by a symbolic expression in $ x $, involving only $ +, -, \\times, \\div, \\text{exponents}, \\text{and parentheses} $.  \nLet $ C \\in \\mathbb{R}^+ $ be the upper bound of integration.  \nLet $ n = 50000 $.  \n\n**Constraints**  \n1. $ f(x) $ is defined and continuous on $ [0, C] $.  \n2. $ C > 0 $.  \n3. The expression for $ f(x) $ contains no transcendental functions (e.g., $ \\sin, \\cos, \\log $).  \n\n**Objective**  \nCompute the Left Rectangular Approximation Method (LRAM) estimate of $ \\int_0^C f(x)\\,dx $:  \n$$\nA = \\sum_{k=0}^{n-1} f\\left( \\frac{k \\cdot C}{n} \\right) \\cdot \\frac{C}{n}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269132","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}