Stickers

Time Limit: 3000ms
Memory Limit: 131072KB

This problem will be judged on UVALive. Original ID: 6510
64-bit integer IO format: %lld      Java class name: Main

  解题:动态规划
 

 #include <bits/stdc++.h>
using namespace std;
const int maxn = ;
int dp[maxn][],a[][maxn],n;
int main(){
int kase;
scanf("%d",&kase);
while(kase--){
scanf("%d",&n);
for(int i = ; i <= n; ++i)
scanf("%d",&a[][i]);
for(int i = ; i <= n; ++i)
scanf("%d",&a[][i]);
memset(dp,,sizeof dp);
for(int i = ; i <= n; ++i){
dp[i][] = max(dp[i-][],max(dp[i-][],dp[i-][]));
dp[i][] = max(dp[i-][],dp[i-][]) + a[][i];
dp[i][] = max(dp[i-][],dp[i-][]) + a[][i];
}
printf("%d\n",max(max(dp[n][],dp[n][]),dp[n][]));
}
return ;
}
/*
2
5
50 10 100 20 40
30 50 70 10 60
7
10 30 10 50 100 20 40
20 40 30 50 60 20 80
*/

UVALive 6510 Stickers的更多相关文章

  1. UVALive - 4108 SKYLINE[线段树]

    UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug ...

  2. UVALive - 3942 Remember the Word[树状数组]

    UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...

  3. UVALive - 3942 Remember the Word[Trie DP]

    UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...

  4. 思维 UVALive 3708 Graveyard

    题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...

  5. UVALive 6145 Version Controlled IDE(可持久化treap、rope)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

  6. UVALive 6508 Permutation Graphs

    Permutation Graphs Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit ...

  7. UVALive 6500 Boxes

    Boxes Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  8. UVALive 6948 Jokewithpermutation dfs

    题目链接:UVALive 6948  Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...

  9. 【暑假】[实用数据结构]UVAlive 3135 Argus

    UVAlive 3135 Argus Argus Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

随机推荐

  1. PKUACM 2018 D chocolate【并查集+克鲁斯卡尔】

    传送:http://poj.openjudge.cn/practice/C18D/ 依然是课件截图 #include<iostream> #include<cstdio> #i ...

  2. robotframework - create dictionary 操作

    1.创建字典 2.从字典中获取的项 -- 打印出 item 3.获取字典的key -- 打印出 key 4.获取字典的value -- 打印出 value 5.获取字典key,value 6.打印出字 ...

  3. Net 发布网站中遇到的几点问题

    1.windows 身份验证设置 打开IIS==>=>找到网站==> 身份验证==>打开功能==>启用windows身份验证 网站设置: 博客参考: http://blo ...

  4. mydatepicker97 日历控件

    官方教程: http://www.my97.net/

  5. 基于Web的Kafka管理器工具之Kafka-manager的编译部署详细安装 (支持kafka0.8、0.9和0.10以后版本)(图文详解)(默认端口或任意自定义端口)

    不多说,直接上干货! 至于为什么,要写这篇博客以及安装Kafka-manager? 问题详情 无奈于,在kafka里没有一个较好自带的web ui.启动后无法观看,并且不友好.所以,需安装一个第三方的 ...

  6. LN : leetcode 538 Convert BST to Greater Tree

    lc 538 Convert BST to Greater Tree 538 Convert BST to Greater Tree Given a Binary Search Tree (BST), ...

  7. Scala-基础-运算符

    import junit.framework.TestCase /** * 运算符 */ class Demo3 extends TestCase { def test_+ { var x = 10; ...

  8. IIS配置负载均衡

    一.下载Nginx安装包 二.修改nginx.conf文件信息 如图: 三.重新加载Nginx (nginx -s reload) 启动Nginx: start nginx 停止Nginx:nginx ...

  9. APP上线被APPStore拒绝的各种原因

    1.程序有重大bug,程序不能启动,或者中途退出.2.绕过苹果的付费渠道,我们之前游戏里的用兑换码兑换金币.3.游戏里有实物奖励的话,一定要说清楚,奖励由本公司负责,和苹果没有关系.4.用到苹果的标志 ...

  10. 【译】x86程序员手册23-6.5组合页与段保护

    6.5 Combining Page and Segment Protection 组合页与段保护 When paging is enabled, the 80386 first evaluates ...