Codeforces Round #325 (Div. 2) Alena's Schedule 模拟
原题链接:http://codeforces.com/contest/586/problem/A
题意:
大概就是给你个序列。。瞎比让你统计统计什么长度
题解:
就瞎比搞搞就好
代码:
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#define MAX_N 123
using namespace std; int n;
int a[MAX_N];
int main(){
cin>>n;
for(int i=;i<n;i++)cin>>a[i];
int cnt=;
for(int i=;i<n-;i++)
if(a[i-]&&a[i+])a[i]=;
for(int i=;i<n;i++)cnt+=a[i];
cout<<cnt<<endl;
return ;
}
Codeforces Round #325 (Div. 2) Alena's Schedule 模拟的更多相关文章
- Codeforces Round #325 (Div. 2) Laurenty and Shop 模拟
原题链接:http://codeforces.com/contest/586/problem/B 题意: 大概就是给你一个两行的路,让你寻找一个来回的最短路,并且不能走重复的路. 题解: 就枚举上下选 ...
- Codeforces Round #368 (Div. 2) B. Bakery (模拟)
Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bak ...
- Codeforces Round #325 (Div. 2) A. Alena's Schedule 水题
A. Alena's Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/pr ...
- Codeforces Round #325 (Div. 2) A. Alena's Schedule 暴力枚举 字符串
A. Alena's Schedule time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #325 (Div. 2) A
A. Alena's Schedule time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #325 (Div. 2)
水 A - Alena's Schedule /************************************************ * Author :Running_Time * Cr ...
- Codeforces Round #284 (Div. 2)A B C 模拟 数学
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #285 (Div. 2) A B C 模拟 stl 拓扑排序
A. Contest time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- Codeforces Round #325 (Div. 2) F. Lizard Era: Beginning meet in the mid
F. Lizard Era: Beginning Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
随机推荐
- Python 3基础教程15-读文件内容
前面两篇关于写文件和更新文件内容,我们最后都是手动去打开检查是否更新了.现在我们这里通过函数读取之前文件内容,打印到屏幕终端. 运行结果:
- Python 3基础教程7-if语句
前面文章介绍的循环语句,这里开始介绍控制语句.直接看下面的demo.py例子 # 这里介绍 if语句 x = 5y = 8z = 4s = 5 if x < y: print('x is les ...
- python 多版本的兼容
1.针对linux版本 linux版本的话,首先调用whereis python 来获取到多版本的路径. root@Ulord-14:~# whereis pythonpython: /usr/bin ...
- C#泛型和泛型约束
一.泛型: 所谓泛型,即通过参数化类型来实现在同一份代码上操作多种数据类型.泛型编程是一种编程范式,它利用“参数化类型”将类型抽象化,从而实现更为灵活的复用. 二.泛型约束: 转自:http://ww ...
- Fomo3D代码分析以及漏洞攻击演示
Fomo3D过去的一周内赚足了噱头,一场光明正大的"庞氏"游戏疯狂吸金,在链得得此前的报道中提到"Fomo3D的开发者,是对生态有深刻理解的现实主义者.Fomo3D鼓励黑 ...
- springboot11 JPA
一.JPA 1. JPA 介绍 JPA是Java Persistence API的简称,中文名Java持久层API,是JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到 ...
- (总结)Nginx与Apache、Tomcat、Resin动静分离核心配置
PS:近来有几个刚使用nginx的新童鞋老问我,nginx+fastcgi不够稳定,偶尔出现502错误,怎么解决?本人使用nginx也有3年多了,也认为php-fpm模块不够稳定,在访问量不大的时候没 ...
- 发现一个form小问题
在使用编辑器及框架时,form表单如果在太靠内的div层里,就取不到textarea的post值,具体原因位置,可能跟框架的CSS有关
- 设计模式之策略模式的Python实现
1. 策略模式解决的是什么问题 策略模式解决的应用场景是这样的: 在业务场景中,需要用到多个算法,并且每个算法的参数是需要调整的.那么当不同的行为堆砌到同一个类中时,我们很难避免使用条件语句来选择合适 ...
- [CF463D]Gargari and Permutations
题目大意:给你$k(2\leqslant k\leqslant5)$个$1\sim n(n\leqslant10^3)$的排列,求它们的最长子序列 题解:将$k$个排列中每个元素的位置记录下来.如果是 ...