double F(double x) {
}
double simpson(double l, double r) {
double m = (l + r) * 0.5;
return (F(l) + 4 * F(m) + F(r)) * (r - l) / 6.0;
}
double asr(double l, double r, double eps, double A) {
double m = (l + r) * 0.5;
double L = simpson(l, m), R = simpson(m, r);
if (fabs(L + R - A) <= 15 * eps)
return L + R + (L + R - A) / 15.0;
return asr(l, m, eps * 0.5, L) + asr(m, r, eps * 0.5, R);
}
double asr(double l, double r, double eps) {
return 2.0 * asr(l, r, eps, simpson(l, r));
}
int dblcmp(double x) {
if (x < -eps)
return -1;
return x > eps;
}
UVA 1356
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<iostream>
#include<string>
#include<sstream>
#include<cctype>
#include<set>
#include<sta