http://codeforces.com/contest/353/problem/C

Codeforces Round #205 (Div. 2)C

#include<stdio.h>

int s[];
int dp[];
char str[];
int Max(int a,int b){
if(a<b)return b;
else return a;
}
int main(){
int n;
while(scanf("%d",&n)!=EOF){
int i;
dp[]=;
for(i=;i<=n;i++){
scanf("%d",&s[i]);
dp[i]=dp[i-]+s[i];
} scanf("%s",str);
int all=,max=;
for(i=n-;i>=;i--){
if(str[i]=='')continue;
max=Max(max,all+dp[i]);
all+=s[i+];
}
max=Max(all,max);
printf("%d\n",max);
} return ;
}

Codeforces Round #205 (Div. 2)C 选取数列可以选择的数使总数最大——dp的更多相关文章

  1. Codeforces Round #205 (Div. 2)

    A #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> ...

  2. Codeforces Round #205 (Div. 2) : D

    思维题,感叹自己的智商不够啊. 思路大概是这样的: 1.排在队伍前面的女生是不用换位置的: 2.女生在队伍中的顺序是不会变的: 3.最后一个女生稳定了则程序结束: 4.每个女生都有个初始位置和最终位置 ...

  3. Codeforces Round #205 (Div. 2) : C

    感觉像是一个数位dp,高位的1如果不选的话,前面低位的数都可以选:不然只能选择为1的数: 代码: #include<iostream> #include<algorithm> ...

  4. Codeforces Round #205 (Div. 2) : B

    如果某个数出现的次数大于或等于2次,那么平均分配到两个容器里面: 这里利用一个k来使得当出现次数为奇数时候分配得更加均匀: 剩下的就平均分配到两个容器里: 代码: #include<iostre ...

  5. Codeforces Round #205 (Div. 2) : A

    题意: 要求找到最少次数的交换次数使得两组数都是偶数: 很明显答案要么是0,要么是1,或者不管怎么交换都不行(-1): 所以: #include<cstdio> #define maxn ...

  6. Codeforces Round #333 (Div. 1) C. Kleofáš and the n-thlon 树状数组优化dp

    C. Kleofáš and the n-thlon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contes ...

  7. Codeforces Round #396 (Div. 2) E. Mahmoud and a xor trip 树形压位DP

      题目链接:http://codeforces.com/contest/766/problem/E Examples input 3 1 2 3 1 2 2 3 out 10 题意: 给你一棵n个点 ...

  8. Codeforces Round #568 (Div. 2) G1. Playlist for Polycarp (easy version) (状压dp)

    题目:http://codeforces.com/contest/1185/problem/G1 题意:给你n给选项,每个选项有个类型和价值,让你选择一个序列,价值和为m,要求连续的不能有两个相同的类 ...

  9. Codeforces Round #416(Div. 2)-811A.。。。 811B.。。。 811C.dp。。。不会

    CodeForces - 811A A. Vladik and Courtesy time limit per test 2 seconds memory limit per test 256 meg ...

随机推荐

  1. python使用安装ipdb

    1.安装 python3版本直接执行pip install ipdb命令安装 python2.7版本的需要指定ipdb的版本 pip install ipdb==0.10.2 等号后面的就是版本,因为 ...

  2. Ansible 手册系列 一(介绍)

    一 介绍 Ansible 是一个配置管理和应用部署工具,功能类似于目前业界的配置管理工具 Chef,Puppet,Saltstack.Ansible 是通过 Python 语言开发.Ansible 平 ...

  3. window.history.go(-1);

    history是你浏览过的网页的url(简单的说就是网址)的集合,也就是你的浏览器里的那个历史记录.它在js里是一个内置对象,就跟document一样,它有自己的方法,go就是其中一个. 这个方法的参 ...

  4. New Concept English there (5)

    25w/m Editors of newspapers and magazines often go to extremes to provide their readers with unimpor ...

  5. Vim技能修炼教程(16) - 浮点数计算函数

    浮点数计算函数 这一节的所有函数,只有在vim编译时支持了+float时才有效. 三角函数 sin() : sine正弦函数 cos() : cosine余弦函数 tan() : tangent正切函 ...

  6. 1. Java EE简介 - JavaEE基础系列

    什么是Java EE? 真的是你理解的那样吗? Java EE, 原名J2EE, 其核心由一系列抽象的标准规范所组成, 是针对目前软件开发中所普遍面临问题的解决方案. 注意以上定义中的"抽象 ...

  7. 用vue实现百度搜索功能

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. .NET反编译工具 .net Reflector_8.3.0.95 下载激活

    在网上找了很久,很多地方都没有注册机,终于机缘巧合下找到了这个有注册机的反编译工具,放于百度网盘,供大家下载 里面有包含如何破解,不过此处也多做一次解释: 注:1.记得断开网络 2.至于杀毒软件,我没 ...

  9. vue-one_demo_music

    简单的音乐盒子 利用计算属性(监听数据),解决上一首,下一首,点击切换 <!DOCTYPE html> <html lang="en"> <head& ...

  10. storyboard出口回退问题

    问题 直接在Main.storyboard拖动添加到出口的时候总是出一些不知名的错误.猜想可能是swift4又TM换了新特性(不过好喜欢啊哈哈哈哈) 解决 其实可以先拖动添加@IBAction函数到代 ...