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 ...
随机推荐
- Codeforces Round #345 (Div. 1) C. Table Compression (并查集)
Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorith ...
- 【noi 2.2_1751】分解因数(递归)
题意:问一个给定正整数的分解因数的方式数.N=a1*a2*...*ak(a1<=a2<=...<=ak). 解法:一步步分解该数,总方式数为一个个因数被分解的方案数之和. 可用大括号 ...
- Jenkins+ant+Jmeter接口自动化框架搭建
工具准备 JDK: jdk1.8.0_111 Ant: apache-ant-1.9.9 Jmeter: apache-jmeter-3.1 Jenkins: jenkins-2.7.4 JDK安装 ...
- 在4.0框架下使用Sqlite数据库
在4.0框架下使用Sqlite数据库出现"混合模式程序集是针对"v2.0.50727"版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集. ...
- nyoj-1236 挑战密室
挑战密室 时间限制:1 s | 内存限制:128 M 提交 状态 排名 题目描述 R组织的特工Dr. Kong 为了寻找丢失的超体元素,不幸陷入WTO密室.Dr. Kong必须尽快找到解锁密码逃离,否 ...
- c# xaml (1)
原文:https://www.wpf-tutorial.com/xaml/what-is-xaml/ vs2017 新建 wpf 项目,在解决方案里会自动创建MainWindow.xaml文件 1.新 ...
- mybaits(十)mybatis常见面试
面试题总结 1.MyBatis 解决了什么问题? 或:为什么要用 MyBatis? 或:MyBatis 的核心特性? 1)资源管理(底层对象封装和支持数据源) 2)结果集自动映射 3)SQL 与代 ...
- 北京网络赛G BOXES 大模拟+BFS
题目描述 Description There is a strange storehouse in PKU. In this storehouse there are n slots for boxe ...
- 2021-2-17:Java HashMap 的中 key 的哈希值是如何计算的,为何这么计算?
首先,我们知道 HashMap 的底层实现是开放地址法 + 链地址法的方式来实现. 即数组 + 链表的实现方式,通过计算哈希值,找到数组对应的位置,如果已存在元素,就加到这个位置的链表上.在 Java ...
- ts 在Function上创建静态属性和方法
interface IMessage { (value: any): void; success(): void; error(): void; version: string; } const Me ...