UVALive 6510 Stickers
Stickers
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的更多相关文章
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- UVALive - 3942 Remember the Word[树状数组]
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...
- UVALive - 3942 Remember the Word[Trie DP]
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...
- 思维 UVALive 3708 Graveyard
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...
- UVALive 6145 Version Controlled IDE(可持久化treap、rope)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- UVALive 6508 Permutation Graphs
Permutation Graphs Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit ...
- UVALive 6500 Boxes
Boxes Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Pract ...
- UVALive 6948 Jokewithpermutation dfs
题目链接:UVALive 6948 Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...
- 【暑假】[实用数据结构]UVAlive 3135 Argus
UVAlive 3135 Argus Argus Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %l ...
随机推荐
- bzoj 1618: [Usaco2008 Nov]Buying Hay 购买干草【背包】
好像是完全背包吧分不清了-- 好像是把数组二维压一维的时候,01背包倒序,完全背包正序 ```cpp include include using namespace std; const int N= ...
- Hadoop回收站及fs.trash参数详解
前言: Linux系统里,个人觉得最大的不方便之一就是没有回收站的概念.rm -rf很容易造成极大的损失.而在Hadoop或者说HDFS里面,有trash(回收站)的概念,可以使得数据被误删以后,还可 ...
- vux修改css样式的2种办法
最近手上有个移动端的项目.前端UI框架是选择的VUX.但是在使用的时候经常会发现框架自带的组件样式和我们要求的不一致.经常需要手动覆盖样式.这里记录下我们使用的2种方法. 我们以XHeader组件 ...
- c++ strcmp函数
用法:加头文件 #include <string.h> 功能:比较字符串s1和s2. 一般形式:strcmp(字符串1,字符串2) 返回值: 当s1<s2时,返回值<0 当s1 ...
- java io 文件下载
/** * 文件下载 * @param response * @param downloadPath * @param docName */ public void downLoadFile( Htt ...
- C#封装访问修饰符
C# 封装 封装 被定义为"把一个或多个项目封闭在一个物理的或者逻辑的包中".在面向对象程序设计方法论中,封装是为了防止对实现细节的访问. 抽象和封装是面向对象程序设计的相关特性. ...
- E - Easy Dijkstra Problem(求最短路)
Description Determine the shortest path between the specified vertices in the graph given in the inp ...
- java大数轻松过
import java.util.Scanner; import java.math.BigInteger; public class Main { public static void main(S ...
- C# 写的正整数四则运算计算器
实际上没能做出来负数.括号.小数的功能,才写这么个标题 大神直接略过,也欢迎指指点点-.- 输入一个四则运算表达式,计算出结果,想想不难,实现起来也不是很容易的. 流程:1.for循环输入的四则运算字 ...
- JavaScript01天学习笔记分享
01知识点 JavaScript 代码运行在浏览器(后缀名.js) 和java完全不同的东西,只是名称类型而已 src 引用脚本 <Script></Script> ale ...