F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Final Challenge

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 151    Accepted Submission(s): 0


Problem Description
Definite integral is an important part of Mathematical Analysis. During Mathematical Analysis lessons, students always find it quite hard to calculate the definite integral. And the software Mathematic is so complex that very few students can master its usage.

So can you develop a simple tool to help the students calculate the definite integral? It¡¯s the final challenge in this contest. This task requires many skills and is so challenging that probably only the god can solve it in 5 hours. Can you solve it and become a god-like person?


Next is the format for all functions in this challenge:
There are six types of basic elementary function:
1¡¢  constant function: C;
2¡¢  power function: x^C;
3¡¢  exponential function: e^x;
4¡¢  logarithmic function: ln(x);
5¡¢  trigonometric function: sin(x), cos(x), tan(x), cot(x), sec(x), cot(x);
6¡¢  inverse circular trigonometric function: asin(x), acos(x), atan(x).
C is a constant number between -100 and 100.

Elementary function is basic elementary function and their composite functions. There are ten types of composite functions. (A and B represent elementary functions)
1¡¢  A+B;
2¡¢  A-B;
3¡¢  -A;
4¡¢  A*B;
5¡¢  A/B;
6¡¢  A^B;
7¡¢  e^A;
8¡¢  ln(A);
9¡¢  sin(A), cos(A), tan(A), cot(A), sec(A), csc(A);
10¡¢  asin(A), acos(A), atan(A).
Arithmetic priority: () > ^ > *, / > +,-

In this problem, the task can be proper integral, improper integral; it is also possible that its indefinite integral isn¡¯t even an elementary function. But you can assume that, if the integrating range is [a,b], then (a,b) will be a subset of the function¡¯s definitions. You can also assume that for any improper integral, the result of it will converge. Finally, it is guaranteed that the final result is between -10,000 and 10,000.


 

Input
The input consists of several test cases. There is a single number above all, the number of cases. There are no more than 50 cases.
Each case contains two lines. The first line contains the function f(x) in the format above. There are no more than 300 letters each. There aren¡¯t any whitespaces in the function.
The second line contains two floating numbers, a and b, £­10,100 <= a, b <= 10,000 representing the integrating range. Notice that a and b can also be INF, -INF representing ¡Ş and -¡Ş.
 

Output
For each case, print the value of . The answer should be rounded to six digits to the right of the decimal point. Use the format in the sample.
 

Sample Input
3 x 1 2 sin(x)^2/(sin(x)+cos(x)) 0 1.5707963268 e^(-x) 0 INF
 

Sample Output
Case 1: 1.500000 Case 2: 0.623225 Case 3: 1.000000
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-25 06:04:33, Gzip enabled