//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-5.2找啊找啊找GF",
        "body": [
            "#include<algorithm>",
            "#include<cstdio>",
            "using namespace std;",
            "int tmp,T1,T2,x,y,n,i,j,k,v1[105],v2[105],w[105],dp[105][105],ans[105][105];",
            "int main(){",
            "    scanf(\"%d\",&n);",
            "    for(i=1;i<=n;i++)scanf(\"%d%d%d\",&v1[i],&v2[i],&w[i]);",
            "    scanf(\"%d%d\",&T1,&T2);",
            "    for(i=1;i<=n;++i)",
            "        for(j=T1;j>=v1[i];--j)",
            "            for(k=T2;k>=v2[i];--k){",
            "            \tif(dp[j][k]<(tmp=dp[j-v1[i]][k-v2[i]]+1)){",
            "            \t\tdp[j][k]=tmp;",
            "            \t\tans[j][k]=ans[j-v1[i]][k-v2[i]]+w[i];",
            "\t\t\t\t}",
            "\t\t\t\telse if(dp[j][k]==tmp)ans[j][k]=min(ans[j][k],ans[j-v1[i]][k-v2[i]]+w[i]);",
            "            }",
            "    printf(\"%d\",ans[T1][T2]);",
            "}",
            ""
        ],
        "description": "插入 二维费用"
    }
}