HDU 1087 Super Jumping! Jumping! Jumping! 动态规划
2013-05-13 21:00
316 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087
[align=left]Problem Description[/align]
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.
View Code G++
Super Jumping! Jumping! Jumping!
[b]Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)[/b][align=left]Problem Description[/align]
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.
View Code G++
// File Name: Super Jumping! Jumping! Jumping! 1087.cpp // Author: sheng // Created Time: 2013年05月13日 星期一 19时23分17秒 #include <iostream> #include <stdio.h> #include <math.h> #include <string.h> using namespace std; #define Max(a, b) (a) > (b) ? (a) : (b) typedef __int64 LL; const int max_n = 1010; long value[max_n]; LL dp[max_n]; int main () { int n; LL ans; while (scanf ("%d", &n) == 1, n) { // memset (dp, 0, sizeof (dp)); for (int i = 1; i <= n; i ++) scanf ("%ld", &value[i]); ans = dp[1] = value[1]; for (int i = 2; i <= n; i ++) { dp[i] = value[i]; for (int j = 1; j < i; j ++) { if (value[i] > value[j]) dp[i] = Max(dp[i], dp[j] + value[i]); } ans = ans > dp[i] ? ans : dp[i]; } printf ("%I64d\n", ans); } return 0; }
相关文章推荐
- HDU 1087 Super Jumping! Jumping! Jumping! 动态规划
- HDU 1087 Super Jumping! Jumping! Jumping! (求最大上升子序列和,动态规划)
- HDU1087 Super Jumping! Jumping! Jumping!(动态规划,最大递增子段和)
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划)
- HDU 1087 Super Jumping! Jumping! Jumping! (动态规划)
- Super Jumping! Jumping! Jumping! 【hdu-1087】【动态规划-最长上升子序列】
- [HDU - 1087]Super Jumping! Jumping! Jumping!(动态规划)
- HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)
- hdu 1087 Super Jumping! Jumping! Jumping! (动态规划)
- [ACM] hdu 1087 Super Jumping! Jumping! Jumping! (动态规划)
- hdu 1087 Super Jumping! Jumping! Jumping! 动态规划
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划DP)
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划)
- E - Super Jumping! Jumping! Jumping! HDU 1087 (基础动态规划)
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划DP)
- HDU 1087 Super Jumping! Jumping! Jumping![动态规划——最大递增子序列]
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划DP)
- 【HDU 1087】Super Jumping! Jumping! Jumping!(最大上升子序列和,动态规划)
- 【HDU 1087】Super Jumping! Jumping! Jumping! (dp动态规划)
- HDU 1087 Super Jumping! Jumping! Jumping! -- 简单动态规划