Polynomial Integration

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 692

Solved: 200

Description
    I guess that everybody has learned the course Calculus(微积分). To tell you the truth, I hate what course because of the endless exercise to do! My teacher was so strict that he assigned many exercise about polynomial integration to me. In each problem, he just gave me a polynomial f(x), starting point xs and ending point xt, and I must calculate the value of . I don’t want to waste my time on that, I need a efficient program to help me calculating that! My dear friend, can you help me?

Input
    The first line of input contains an integer T, indicating test cases.

    In each test case, the first line consist of 3 integers: n, xs, xt. N means that f(x) consists of n blocks:

    Then following N lines of input, each line consists two integers: ai and di, representing the coefficient and degree of the i-th part of f(x), respectively.

    1 <= n <= 10,

    1 <= xs <= xt <= 100,

    -3 <= di <= 3,

    0 <= ai <= 20.

Output
    In each test case, the output contains one line.

    The only one line is formatted as "Case #X: Y", where X is the test case number (starting with 1), Y is the result of , rounded to three decimal points.

sample input
    2
    2 1 2
    2 1
    3 2
    1 1 5
    1 0
sample output
    Case #1: 10.000
    Case #2: 4.000
hint
source
Kangqi LUO
© 2015 HUST ACMICPC TEAM. All Right Reserved.