//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-1.5cf_flow",
        "body": [
            "#include<cstdio>",
            "#define LL long long",
            "#define Re register int",
            "int a,b,P;",
            "inline int cf_flow(Re a,Re k){// 递归 快速乘",
            "\tif(!k)return 0;",
            "\tRe x=1,y=cf_flow(a,k>>1);",
            "\tx=(LL)y+y%P;",
            "\tif(k&1)x=(LL)x+a%P;",
            "\treturn x%P;",
            "}",
            "inline int cf(Re a,Re b){// 二进制法 快速乘 ",
            "\tRe x=0;",
            "\twhile(b){",
            "\t\tif(b&1)x=(x+a)%P;",
            "\t\ta=a*2%P,b>>=1;",
            "\t}",
            "\treturn x%P;",
            "}",
            "inline int mi_slow(Re a,Re k){// 递归 快速幂 ",
            "\tif(!k)return 1%P;",
            "\tRe x=1,y=mi_slow(a,k>>1);",
            "\tx=(LL)y*y%P;",
            "\tif(k&1)x=(LL)x*a%P;",
            "\treturn x%P;",
            "}",
            "inline int mi(Re x,Re k){// 二进制法 快速幂 ",
            "\tRe s=1;",
            "    while(k){",
            "    \tif(k&1)s=(LL)s*x%P;",
            "    \tx=(LL)x*x%P,k>>=1;",
            "    }",
            "    return s%P;",
            "}",
            "int main(){}",
            ""
        ],
        "description": "插入 快速幂+龟速乘"
    }
}