题目链接: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!的更多相关文章

  1. 解题报告 HDU1087 Super Jumping! Jumping! Jumping!

    Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  2. HDU1087:Super Jumping! Jumping! Jumping!(DP)

    Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very ...

  3. HDU1087 Super Jumping! Jumping! Jumping! 最大连续递增子段

    Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  4. kuangbin专题十二 HDU1087 Super Jumping! Jumping! Jumping! (LIS)

    Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  5. HDU1087 Super Jumping! Jumping! Jumping! —— DP

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limi ...

  6. hdu1087 Super Jumping! Jumping! Jumping!---基础DP---递增子序列最大和

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1087 题目大意: 求递增子序列最大和 思路: 直接dp就可以求解,dp[i]表示以第i位结尾的递增子 ...

  7. HDU1087 Super Jumping! Jumping! Jumping!(LIS)

    题目意思: http://acm.hdu.edu.cn/showproblem.php? pid=1087 此题的意思求最长上升子序列的和. 题目分析: 在求最长上升子序列的时候,不在保存最长的个数, ...

  8. HDU1087 - Super Jumping! Jumping! Jumping!【动态规划】

    zh成功的在他人的帮助下获得了与小姐姐约会的机会,同时也不用担心被非"川大"的女票发现了,可是如何选择和哪些小姐姐约会呢?zh希望自己可以循序渐进,同时希望挑战自己的极限,我们假定 ...

  9. HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)

    传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...

随机推荐

  1. iOS网页调试

    iOS上安装Chrome 打开Chrome://inspect,选择开始收集日志 新选项卡中访问目标站点 切换回日志收集页面,即可看到日志信息 https://blog.chromium.org/20 ...

  2. kubernetes实战-配置中心(四)分环境使用apollo配置中心

    要进行分环境,需要将现有实验环境进行拆分 portal服务,可以各个环境共用,但是apollo-adminservice和apollo-configservice必须要分开. 1.zk环境拆分为tes ...

  3. 1077E Thematic Contests 【二分答案】

    题目:戳这里 题意:n个数代表n个problem,每个数的值代表这个问题的topic,让我们挑出一些problems,满足挑出problems的topic是首项为a1公比为2的等比数列(每种topic ...

  4. hdu 4465 Candy (非原创)

    LazyChild is a lazy child who likes candy very much. Despite being very young, he has two large cand ...

  5. HDU4565-数学推导求递推公式+矩阵快速幂

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4565 我们带着这个根号是没法计算的 我们仔细观察一下,(a+sqrt(b))^n用二项式定理展开,我 ...

  6. p5.js

    p5.js p5.j​​s是一个用于创意编码的JavaScript库,其重点是使艺术家,设计师,教育者,初学者以及其他任何人都可以访问并包含所有编码! https://p5js.org/ https: ...

  7. Java & Maven & Spring & Spring Boot

    Java & Maven & Spring & Spring Boot Spring Boot sb https://start.spring.io/ Spring 4 htt ...

  8. useful podcast

    useful podcast front end podcast https://shoptalkshow.com https://stackoverflow.blog/podcast/ SoundC ...

  9. c++ winapi 在当前程序(local)调用目标程序(target)的函数

    GameCheat stackoverflow 如果你的目标程序是x86/x64, 那么当前程序也需要编译为x84/x64 #include <iostream> #include < ...

  10. 大胆预计SPC算力空投收益,月收益22.8%

    此前,NGK官方公告表示,NGK算力持有者获得SPC的数量是根据200万枚SPC除以全网算力总量决定的. 举个例子,假设全网算力总量为500万,那么每个算力持有者如果持有一个算力,则可获得200万÷5 ...