Function Run Fun Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17843 Accepted: 9112 Description We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <= 0 or b <= 0 or c <= 0, then w(a, b…
题目链接:http://poj.org/problem?id=1579 思路分析:题目给出递归公式,使用动态规划的记忆搜索即可解决. 代码如下: #include <stdio.h> #include <string.h> + ; int dp[MAX_N][MAX_N][MAX_N]; int w( int a, int b, int c ) { ) return dp[a][b][c]; || b <= || c <= ) ; else if ( a < b…
You are playing a two player game. Initially there are n integer numbers in an array and player A and B get chance to take them alternatively. Each player can take one or more numbers from the left or right end of the array but cannot take from both…
题目传送门:http://poj.org/problem?id=1579 Function Run Fun Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20560 Accepted: 10325 Description We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <=…
Test for Job Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 8990 Accepted: 2004 Description Mr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have a job…
http://poj.org/problem?id=3186 Description 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…
题目传送门:http://poj.org/problem?id=2704 Pascal's Travels Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5535 Accepted: 2500 Description An n x n game board is populated with integers, one nonnegative integer per square. The goal is to tr…
题意:略 直接用记忆化搜索就行了 #include<cstdio> #include<iostream> using namespace std; int n,m; int map[105][105]; int len[105][105]={0}; int dp(int x,int y) { int max,temp; if(len[x][y]) return len[x][y]; max=0; if(x+1<n&&map[x][y]>map[x+1][…
Cow Bowling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14210 Accepted: 9432 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…
http://acm.fzu.edu.cn/problem.php?pid=1005 Description The fastfood chain McBurger owns several restaurants along a highway. Recently, they have decided to build several depots along the highway, each one located at a restaurant and supplying several…
Triangle War Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2685 Accepted: 1061 Description Triangle War is a two-player game played on the following triangular grid: Two players, A and B, take turns filling in any dotted line connec…