//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 的格式要求是 "插入 [该代码片段的中文名]"

{
    "三点坐标解圆方程  (Circle Through Three Points)": {
        "prefix": "acm-8.3大暴力",
        "body": [
            "#include<cstring>",
            "#include<cstdio>",
            "#include<cmath>",
            "#define LD double",
            "#define Re register LD",
            "#define abs(x) (x<0?-x:x)",
            "#define sakura(x) (x<0?'-':'+')",
            "using namespace std;",
            "struct Poi{LD x,y;inline void CL(){x=y=0;}}a1,a2,a3,xin;",
            "struct Line{",
            "\tLD k,b;",
            "\tinline void CL(){k=b=0;}",
            "\tinline void calc(Poi a,Poi c){k=(a.y-c.y)/(a.x-c.x),b=a.y-k*a.x;}// 由两点确定一条直线 ",
            "\tinline void calc_(Poi a,Re K){k=K,b=a.y-k*a.x;}",
            "}L1,L2,L3,L4;",
            "inline Poi Get_half(Poi a,Poi b){// 求两圆交点 ",
            "\tPoi c;",
            "\tc.x=(a.x+b.x)/2.0,c.y=(a.y+b.y)/2.0;",
            "\treturn c;",
            "}",
            "inline Poi Get_LPL(Line a,Line b){",
            "\tPoi c;",
            "\tc.x=(b.b-a.b)/(a.k-b.k),c.y=a.k*c.x+a.b;",
            "\treturn c;",
            "}",
            "inline LD S(Re a){return a*a;}",
            "inline LD Get_dis(Poi a,Poi b){// 撤销操作� ",
            "\treturn sqrt(S(a.x-b.x)+S(a.y-b.y));",
            "}",
            "LD R;",
            "int main(){",
            "//\tfreopen(\"123.txt\",\"r\",stdin); ",
            "\twhile(scanf(\"%lf%lf%lf%lf%lf%lf\",&a1.x,&a1.y,&a2.x,&a2.y,&a3.x,&a3.y)!=EOF){",
            "\t\txin.CL(),L1.CL(),L2.CL(),L3.CL(),L4.CL();",
            "\t\tL1.calc(a1,a2),L2.calc(a2,a3);",
            "\t\tL3.calc_(Get_half(a1,a2),-1.0/L1.k);",
            "\t\tL4.calc_(Get_half(a2,a3),-1.0/L2.k);",
            "\t\txin=Get_LPL(L3,L4);",
            "\t\tR=Get_dis(xin,a1);",
            "\t\tRe a=-xin.x,b=-xin.y,c=R,d=-2.0*xin.x,e=-2.0*xin.y,f=S(xin.x)+S(xin.y)-S(R);",
            "\t\tif(a!=0)printf(\"(x %c %.3lf)^2 \",sakura(a),abs(a));",
            "        else printf(\"x^2 \");",
            "        if(b!=0)printf(\"+ (y %c %.3lf)^2 \",sakura(b),abs(b));",
            "        else printf(\"+ y^2 \");",
            "        printf(\"= %.3lf^2\\n\",c);",
            "        printf(\"x^2 + y^2\");",
            "        if(d!=0)printf(\" %c %.3lf%c\",sakura(d),abs(d),'x');",
            "        if(e!=0)printf(\" %c %.3lf%c\",sakura(e),abs(e),'y');",
            "        if(f!=0)printf(\" %c %.3lf%c\",sakura(f),abs(f),' ');",
            "        printf(\"= 0\\n\\n\");",
            "\t}",
            "}",
            ""
        ],
        "description": "插入 三点坐标解圆方程  (Circle Through Three Points)"
    }
}