//Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and 
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
// same ids are connected.
// prefix 的格式要求是 acm-[一级标题编号].[二级标题编号][该代码片段的英文简称]
// description 的格式要求是 "插入 [该代码片段的中文名]"

{
    "自适应辛普森积分": {
        "prefix": "acm-8.3全局精度",
        "body": [
            "#include<algorithm>",
            "#include<cstdio>",
            "#include<cmath>",
            "#define LD double",
            "#define LL long long",
            "#define Re register int",
            "#define Vector Point",
            "using namespace std;",
            "const LD eps=1e-13;",
            "inline int dcmp(LD a){return a<-eps?-1:(a>eps?1:0);}",
            "LD a,b,c,d,L,R;",
            "inline LD F(LD x){return (c*x+d)/(a*x+b);}",
            "inline LD Simpson(LD L,LD R){return (R-L)*(F(L)+4.0*F((L+R)*0.5)+F(R))/6.0;}",
            "inline LD sakura(LD L,LD R,LD now){",
            "\tLD mid=(L+R)*0.5,FL=Simpson(L,mid),FR=Simpson(mid,R);",
            "\tif(!dcmp(now-FL-FR))return now;",
            "\treturn sakura(L,mid,FL)+sakura(mid,R,FR);",
            "}",
            "int main(){",
            "//\tfreopen(\"123.txt\",\"r\",stdin);",
            "\tscanf(\"%lf%lf%lf%lf%lf%lf\",&a,&b,&c,&d,&L,&R);",
            "\tprintf(\"%lf\\n\",sakura(L,R,Simpson(L,R)));",
            "}",
            ""
        ],
        "description": "插入 自适应辛普森积分"
    }
}