ICode9

精准搜索请尝试: 精确搜索
  • POJ 31862021-03-08 13:01:43

    水题,思路很简单,不过这里有一个另一思路,也蛮有启发性的(关于状态定义) #include <iostream> #include <algorithm> #include <string> #include <vector> #include <cstdio> #include <cstring> using namespace std; const int maxn = 2005; int v[maxn]; int dp[ma

  • Treats for the Cows POJ - 3186 dp 区间dp2020-01-28 18:54:38

    //dp[i][j]表示第i次从左边取,第j次从右边取的价值,所以我们可以得到状态方程 //dp[i][j]=max(dp[i-1][j]+(i+j)*a[i],dp[i][j-1]+(i+j)*a[n-j+1]) (i > 0 && j > 0 ) //dp[i][0]=dp[i-1][0]+i*a[i],dp[0][i] dp[0][i-1]+i*a[n-i+1]; #include<cstdio> #include<cmath> #include&

  • POJ 31862019-08-02 23:52:47

    题意略。 思路:有一点区间dp的意思。 我令dp[ i ][ j ]表示:区间[1 , i]和区间[j , N]按某种顺序插值排好,所能获得的最大值。 状态转移方程:dp[ i ][ j ] = max(dp[i - 1][ j ] + v[ i ] * (i + N - j + 1) , dp[ i ][ j + 1 ] + v[ j ] * (i + N - j + 1))。 代码如下: #include<iost

  • POJ - 3186 Treats for the Cows(dp)2019-07-28 11:56:47

    FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day and wants to maximize the money he receives over a given period time. The treats are interesting for many reasons

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有