想不通转移方程哪里错了

P1417 烹调方案

Wenchih @ 2020-02-20 16:04:25


    int tmp;
    for(int i=1;i<=n;i++)
    {
        tmp=pp[i].a-(pp[i].c*pp[i].b);
        for(int j=pp[i].c;j<=t;j++)
        {
            dp[i][j]=maxx(dp[i][j-1],maxx(dp[i-1][j],dp[i-1][j-pp[i].c]+tmp));
            tmp-=pp[i].b;
        }
    }

|