//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.1线筛",
        "body": [
            "#pragma GCC optimize(3,\"Ofast\",\"inline\")",
            "#pragma GCC optimize(2)",
            "#include<cstdio>",
            "const int N=1e6;",
            "int cnt,i,j,pan[N+1],pri[N/3],phi[N+1];",
            "inline void get_phi(int N){",
            "    pan[1]=1,phi[1]=1;",
            "    for(int i=2;i<=N;++i){",
            "        if(!pan[i])pri[++cnt]=i,phi[i]=i-1;",
            "        for(int j=1;j<=cnt&&pri[j]<=N/i;++j){",
            "            pan[i*pri[j]]=1;",
            "            if(i%pri[j])phi[i*pri[j]]=phi[i]*(pri[j]-1);",
            "            else{phi[i*pri[j]]=phi[i]*pri[j];break;}",
            "        }",
            "    }",
            "}",
            "int main(){",
            "\tget_phi(N);",
            "\tfor(i=1;i<=N;++i)printf(\"%d: %d\\n\",i,phi[i]);",
            "}",
            ""
        ],
        "description": "插入 欧拉函数"
    }
}