//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-7.5Gauss",
        "body": [
            "bool Gauss(Matrix a, int n) {",
            "    for(int i=1; i<=n; i++) {",
            "        int r=i;",
            "        for(int j=i+1; j<=n; j++) ",
            "            if(abs(a[j][i]) > abs(a[r][i])) r=j;",
            "        if(abs(a[r][i])<eps) return false;",
            "        if(r!=i) for(int j=1; j<=n+1; j++) swap(a[r][j], a[i][j]);",
            "        ",
            "        for(int j=i+1; j<=n; j++) {",
            "            double t = a[j][i]/a[i][i];",
            "            for(int k=i; k<=n+1; k++) a[j][k] -= t*a[i][k];",
            "        }",
            "    }",
            "    for(int i=n; i>=1; i--) {",
            "        for(int j=n; j>i; j--) a[i][n+1] -= a[i][j]*a[j][n+1];",
            "        a[i][n+1] /= a[i][i];",
            "    }",
            "    return true;",
            "}"
        ],
        "description": "插入 高斯消元"
    }
}