//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樱花",
        "body": [
            "#include<algorithm>",
            "#include<cstdio>",
            "using namespace std;",
            "int x,a,b,c,d,T,n,i,j,t,f[1010],v[100010],w[100010];",
            "int main(){",
            "\tscanf(\"%d:%d%d:%d%d\",&a,&b,&c,&d,&n);",
            "\tT=c*60+d-a*60-b;",
            "\tfor(i=1;i<=n;i++){",
            "\t\tscanf(\"%d%d%d\",&a,&b,&c);",
            "\t\tif(!c){",
            "\t\t\tfor(j=0;j+a<=T;j++)",
            "\t\t\t\tf[j+a]=max(f[j+a],f[j]+b);",
            "\t\t\tcontinue;",
            "\t\t}",
            "\t\tx=1;",
            "\t\twhile(c>=x){v[++t]=x*a,w[t]=x*b,c-=x,x<<=1;}",
            "\t\tv[++t]=c*a,w[t]=c*b;",
            "\t}",
            "\tfor(i=1;i<=t;i++)",
            "\t\tfor(j=T;j>=v[i];j--)",
            "\t\t\tf[j]=max(f[j],f[j-v[i]]+w[i]);",
            "\tprintf(\"%d\",f[T]);",
            "\treturn 0;",
            "}",
            ""
        ],
        "description": "插入 混合背包"
    }
}