题意:给你n种花,m个盆,花盆是有顺序的,每种花只能插一个花盘i,下一种花的只能插i<j的花盘,现在给出价值,求最大价值 简单dp #include <iostream> #include<cstdio> #include<cstring> using namespace std; #define N 110 int dp[N][N],a[N][N]; int main(int argc, char** argv) { int n,m,i,j; while(sca…
题目链接:http://poj.org/problem?id=3176 思路分析:基本的DP题目:将每个节点视为一个状态,记为B[i][j], 状态转移方程为 B[i][j] = A[i][j] + Max( B[i+1][j], B[i+1][j+1] ); 代码如下: #include <stdio.h> + ; int A[MAX_N][MAX_N], B[MAX_N][MAX_N]; int Max( int a, int b ) { return a > b ? a : b;…
看题传送门门:http://poj.org/problem?id=1163 困死了....QAQ 普通做法,从下往上,可得状态转移方程为: dp[i][j]= a[i][j] + max (dp[i+1][j] , dp[i+1][j+1] ); #include<cstdio> #include<cstring> int a[101][101]; int dp[101][101]; int main() { int n; while(~scanf("%d",…
Description The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: Then the other cows traverse the triangle starting from its…