题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2571 简单dp, dp[n][m] +=( dp[n-1][m],dp[n][m-1],d[i][k] ) k 为m的因子 PS:0边界要初始为负数(例如-123456789)越大越好 代码: #include <stdio.h> #include <string.h> int dp[25][1005]; #define max(x,y) x > y ? x : y int m…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33384 Accepted Submission(s): 15093 Problem Description Nowadays, a kind of chess game called “Super Jumping!…
Fibonacci String Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4568 Accepted Submission(s): 1540 Problem Description After little Jim learned Fibonacci Number in the class , he was very int…
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 161294 Accepted Submission(s): 37775 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max s…
/*递推公式dp[i]=MAX(dp[i-1],dp[i-2]+a[j])*/ #include<stdio.h> #include<string.h> #define N 210000 int a[N],f[N],dp[N]; int Max(int v,int vv) { return v>vv?v:vv; } int main() { int n,m,i,j,k; while(scanf("%d%d",&n,&m)!=EOF) { m…
#include<iostream> using namespace std; const int N=1e5; int T,n; int a[N],b[N]; int dp[N]; int main() { cin>>T; while(T--) { cin>>n; ;i<=n;i++) cin>>a[i]; ;i<=n-;i++) cin>>b[i]; dp[]=a[]; ;i<=n;i++) dp[i]=min(dp[i-]…
思路和2391一样的.. <span style="font-size:24px;">#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; const int inf=(0x7f7f7f7f); int main() { int a; int s[10005]; int w[10005];…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5375 题面: Gray code Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 626 Accepted Submission(s): 369 Problem Description The reflected binary cod…
题目 简单dp //简单的dp #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; ][];//dp[i][j] di i ceng di j ge zui da he ][]; int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&…
I - 简单dp 例题扩展 Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HD…
免费馅饼 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 102 Accepted Submission(s) : 35 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,…
Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description Noura Boubou is a Syrian volunteer at ACM ACPC (Arab Collegiate Programming Contest) since 2011. She graduated from Tishreen Un…
http://acm.hdu.edu.cn/showproblem.php? pid=4123 Problem Description Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are N houses and N - 1 roads in his village. Each road connects two houses,…
J - 简单dp Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Description It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveni…
题意:给你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://acm.hdu.edu.cn/showproblem.php?pid=3709 Problem Description A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit.…
D. Fedor and Essay time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the E…
简单dp 状态方程很好想,主要是初始化.... 代码: #include<iostream> #include<cstdlib> #include<cstdio> #include<cstring> using namespace std; #define MAX 1010 #define _INF -100000000 int n,m; int f[MAX][MAX]; int dp[MAX][MAX]; int main() { int t; scanf…
XHXJ's LIS Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2265 Accepted Submission(s): 927 Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then careful…
You Are the One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3348 Accepted Submission(s): 1524 Problem Description The TV shows such as You Are the One has been very popular. In order to m…