Polygon

Time Limit: 3000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 4752
64-bit integer IO format: %I64d      Java class name: Main

Description

  In this problem, you're given a function f(x) = ax^2 + bx + c(x in [l, r]) and a simple polygon. And we need you to figure out the length of f(x) in this polygon.

Input

  There are several test cases and the cases end with EOF. For each case:

  The first line contains six integers n (1 <= n <= 20000), a(a != 0), b, c, l and r, which are the total of the points of the polygon and the parameters of the function and these parameters are in the range [-20000, 20000].

  The next n lines contains two integers x and y, which are the coordinate of the point and both of them are in the range[-10^9, 10^9]. We can ensure that there is a edge between i-th point and (i+1)-th point (1 <= i < n) and there is a edge between first point and n-th point.

Output

  For each case, output your answer, your answer should rounded to two decimal places.

Sample Input

4 1 0 0 -100 100
-10 0
10 0
10 10
-10 10

Sample Output

21.52

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .