HDu1087 Super Jumping! Jumping! Jumping!
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087
分析:简单dp;dp[i] = max (dp[i], dp[j] + a[i])
1 #include<iostream>
2 #include<sstream>
3 #include<cstdio>
4 #include<cstdlib>
5 #include<string>
6 #include<cstring>
7 #include<algorithm>
8 #include<functional>
9 #include<iomanip>
10 #include<numeric>
11 #include<cmath>
12 #include<queue>
13 #include<vector>
14 #include<set>
15 #include<cctype>
16 #define PI acos(-1.0)
17 const int INF = 0x3f3f3f3f;
18 const int NINF = -INF - 1;
19 const int maxn = (1 << 15) + 10;
20 typedef long long ll;
21 using namespace std;
22 int n;
23 int arr[1005];
24 int dp[1005];
25 int main()
26 {
27 while (scanf("%d", &n) && n)
28 {
29 for (int i = 0; i < n; ++i)
30 scanf("%d", &arr[i]);
31 for (int i = 0; i < n; ++i) dp[i] = arr[i];
32 for (int i = 0; i < n; ++i)
33 {
34 for (int j = 0; j < i; ++j)
35 {
36 if (arr[i] > arr[j])
37 dp[i] = max(dp[i], dp[j] + arr[i]);
38 }
39 }
40 int ans = 0;
41 for (int i = 0; i < n; ++i)
42 ans = max(ans, dp[i]);
43 printf("%d\n", ans);
44 }
45 return 0;
46 }
HDu1087 Super Jumping! Jumping! Jumping!的更多相关文章
- 解题报告 HDU1087 Super Jumping! Jumping! Jumping!
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU1087:Super Jumping! Jumping! Jumping!(DP)
Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very ...
- HDU1087 Super Jumping! Jumping! Jumping! 最大连续递增子段
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- kuangbin专题十二 HDU1087 Super Jumping! Jumping! Jumping! (LIS)
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU1087 Super Jumping! Jumping! Jumping! —— DP
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limi ...
- hdu1087 Super Jumping! Jumping! Jumping!---基础DP---递增子序列最大和
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1087 题目大意: 求递增子序列最大和 思路: 直接dp就可以求解,dp[i]表示以第i位结尾的递增子 ...
- HDU1087 Super Jumping! Jumping! Jumping!(LIS)
题目意思: http://acm.hdu.edu.cn/showproblem.php? pid=1087 此题的意思求最长上升子序列的和. 题目分析: 在求最长上升子序列的时候,不在保存最长的个数, ...
- HDU1087 - Super Jumping! Jumping! Jumping!【动态规划】
zh成功的在他人的帮助下获得了与小姐姐约会的机会,同时也不用担心被非"川大"的女票发现了,可是如何选择和哪些小姐姐约会呢?zh希望自己可以循序渐进,同时希望挑战自己的极限,我们假定 ...
- HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)
传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...
随机推荐
- codeforces644B. Processing Queries (模拟)
In this problem you have to simulate the workflow of one-thread server. There are n queries to proce ...
- 单源最短路问题 Dijkstra 算法(朴素+堆)
选择某一个点开始,每次去找这个点的最短边,然后再从这个开始不断迭代,更新距离. 代码: 朴素(vector存图) #include <iostream> #include <cstd ...
- 行业动态 | 腾讯合作商Babylon使用Cassandra保护患者数据并提高医疗效果
医疗世界正在快速朝向个性化和低成本的方向发展,Babylon Health看到了这样的机会--通过开创性的云端应用来大幅扩张和改进他们所提供的服务. 通过使用基于Apache Cassandra的 ...
- codeforces 875B
B. Sorting the Coins time limit per test 1 second memory limit per test 512 megabytes input standard ...
- (转载)RTMP协议中的AMF数据 http://blog.csdn.net/yeyumin89/article/details/7932585
为梦飞翔 (转载)RTMP协议中的AMF数据 http://blog.csdn.net/yeyumin89/article/details/7932585 这里有一个连接,amf0和amf3的库, ...
- Android 神奇的SpannableStringBuilder
一 无图言屌 先看看神奇的效果 仅用一个TextView实现 二 SpannableStringBuilder Google官方介绍 This is the class for text whose ...
- ossutilmac64
ossutilmac64 ossutil是以命令行方式管理OSS数据的工具,提供方便.简洁.丰富的存储空间(Bucket)和文件(Object)管理命令,支持Windows.Linux. Mac平台. ...
- fibonacci number & fibonacci sequence
fibonacci number & fibonacci sequence https://www.mathsisfun.com/numbers/fibonacci-sequence.html ...
- shit LeetCode interview Question
shit LeetCode interview Question https://leetcode.com/interview/1/ 有点晕,啥意思,没太明白,到底是要按什么排序呀? 去掉 标识符 不 ...
- Internationalization API & ECMA-402
Internationalization API & ECMA-402 i18n https://caniuse.com/?search=Internationalization API In ...