LCC '22 Contest 6 J1 - Integral Calculus

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Annie is practicing for the AP calculus exam in a few weeks. One problem in calculus is finding the area under the graph between two points a and b \ (a \le b) of a function (above the x-axis only). While she knows how to solve this problem for many different functions, Annie is stumped by functions of the form f(x)=mx. Given a function of that form, and integer points a and b, can you solve the problem?

Constraints

For all subtasks,

1 \le m \le 10

0 \le a \le b \le 100

m, a, b \in \mathbb{Z}

Subtask 1 [33%]

a = b

Subtask 2 [33%]

a = 0

Subtask 3 [34%]

No additional constraints.

Input Specification

The first line of input will contain m. The second will contain a, and the third will contain b.

Output Specification

Output the area under the graph between the two points a and b of the function f(x)=mx. Output exactly to one decimal place, even if the area is an integer. For example, an answer of 8 should be output as 8.0.

Sample Input 1

2
1
3

Sample Output 1

8.0

Explanation for Sample Output 1

The graph of f(x)=2x (red) and the area under the graph between 1 and 3 (green) is shown as follows:

The area is 8.0.

Sample Input 2

9
99
99

Sample Output 2

0.0

Sample Input 3

3
2
3

Sample Output 3

7.5

Comments

There are no comments at the moment.