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. linux-git shell colors

    git config --global color.status auto git config --global color.diff auto git config --global color. ...

  2. JavaScript--跨域

    跨域 什么是跨域? 跨域请求就是不同域的网站之间的文件数据之间的传送 ,由于浏览器的同源策略机制(基于安全,同源策略阻止从一个源加载的文档或脚本获取或设置另一个源加载的文档的属性)Ajax直接请求普通 ...

  3. C# 设计模式巩固 - 单例模式

    前言 设计模式的文章很多,所以此文章只是为了巩固一下自己的基础,说的不详细请见谅. 介绍 - 单例模式 官方定义:确保一个类只有一个实例,并提供一个全局访问点. 通俗定义:就是一个类只有一个单个实例. ...

  4. shell脚本中四则运算

    方法一: (())       ##在括号里面可以直接对变量进行操作 例如:vim  test.sh 方法二: let       ##let后面加要操作的运算 例如:  方法三: expr      ...

  5. Win10启动盘制作工具

    Rufus https://rufus.akeo.ie/ http://www.iplaysoft.com/windows-10-udisk-install.html

  6. 在ORACLE中移动数据库文件

    转载: 在ORACLE中移动数据库文件 --ORACLE数据库由数据文件,控制文件和联机日志文件三种文件组成. --由于磁盘空间的变化,或者基于数据库磁盘I/O性能的调整等, --我們可能会考虑移动数 ...

  7. jquery.i18n.properties.js hacking

    /****************************************************************************** * jquery.i18n.proper ...

  8. 【剑指offer】反转链表,C++实现(链表)

    1.题目 输入一个链表的头结点,首先反转链表后,然后输出链表的所有元素(牛客网). struct ListNode { int val; struct ListNode *next; }; 2.思路 ...

  9. 【sklearn】from sklearn.extermals import joblib(保存模型和加载模型)

    原创博文,转载请注明出处! sklearn中保存和加载模型的方法 1.载入模块 from sklearn.externals joblib. model = joblib. # -*- coding: ...

  10. BJOI 2019 模拟赛 #2 题解

    T1 完美塔防 有一些空地,一些障碍,一些炮台,一些反射镜 障碍会挡住炮台的炮, 反射镜可以 90° 反射炮台的光线,炮台可以选择打他所在的水平一条线或者竖直一条线 求是否有一组方案满足每个空地必须要 ...