CodeForces 688A Opponents (水题)
题意:给定 n 行数,让你找出连续最多的全是1的个数。
析:好像也没什么可说的,那就判断一下,并不断更新最大值呗。
代码如下:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <set>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string> using namespace std;
typedef long long LL;
string s; int main(){
int n, d, cnt = 0;
bool ok = false;
int m = -1;
scanf("%d %d", &n, &d);
for(int i = 0; i < d; ++i){
cin >> s;
int j;
for(j = 0; j < n; ++j)
if(s[j] != '1') break; if(ok && j != n) ++cnt;
else if(j != n){ ok = true; cnt = 1; }
else{ cnt = 0; ok = false; }
m = max(m ,cnt);
}
printf("%d\n", m);
return 0;
}
CodeForces 688A Opponents (水题)的更多相关文章
- codeforces 688A A. Opponents(水题)
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- Codeforces数据结构(水题)小结
最近在使用codeblock,所以就先刷一些水题上上手 使用codeblock遇到的问题 1.无法进行编译-------从setting中的编译器设置中配置编译器 2.建立cpp后无法调试------ ...
- CodeForces 705A Hulk (水题)
题意:输入一个 n,让你输出一行字符串. 析:很水题,只要判定奇偶性,输出就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,10240 ...
- CodeForces 705B (训练水题)
题目链接:http://codeforces.com/problemset/problem/705/B 题意略解: 两个人玩游戏,解数字,一个数字可以被分成两个不同或相同的数字 (3可以解成 1 2) ...
- codeforces hungry sequence 水题
题目链接:http://codeforces.com/problemset/problem/327/B 这道题目虽然超级简单,但是当初我还真的没有想出来做法,囧,看完别人的代码恍然大悟. #inclu ...
- codeforces 377A. Puzzles 水题
A. Puzzles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/33 ...
- CodeForces 474B Worms (水题,二分)
题意:给定 n 堆数,然后有 m 个话询问,问你在哪一堆里. 析:这个题是一个二分题,但是有一个函数,可以代替写二分,lower_bound. 代码如下: #include<bits/stdc+ ...
- CodeForces - 682B 题意水题
CodeForces - 682B Input The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — ...
随机推荐
- 对ashx请求用Gzip,Deflated压缩
//GZIP压缩 //查看请求头部 string acceptEncoding = context.Request.Headers["Accept-Encoding"].ToStr ...
- Spring Cloud 入门 之 Ribbon 篇(二)
原文地址:Spring Cloud 入门 之 Ribbon 篇(二) 博客地址:http://www.extlight.com 一.前言 上一篇<Spring Cloud 入门 之 Eureka ...
- 更新RDL文件中的数据集(DataSets)
由于RDL XML文件中使用了两个命名空间: <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/ ...
- H5页面获取openid,完成支付公众号(未关注公众号)支付
一.页面授权 // 进入页面获取权限code function initAuthorizeCode() { var appid = $("#appid").val();//公众号a ...
- H.265:高清视频的最佳选择
H.265技术经过2年发展,我们认为H.265高清监控产品市场化才真正开始.那么H.265的到来,大家又对该技术真正了解多少呢?下面就让我们一起来了解该技术.... HEVC/H.265标准于2013 ...
- AngularJS学习笔记(2)——与用户交互的动态清单列表
与用户交互的动态清单列表 以我之前写的一个清单列表页面作为例子(MVC模式的清单列表效果),优化前代码如下: <!DOCTYPE html> <html ng-app="t ...
- Linux Tomcat8 访问管理页面 403 Access Denied
http://blog.csdn.net/u012167045/article/details/61624226 1:修改conf/tomcat-users.xml配置文件 2:vi /usr/loc ...
- 改成maven工程
configure->convert to Maven Project
- Hadoop之MapReduce学习笔记(二)
主要内容: mapreduce编程模型再解释: ob提交方式: windows->yarn windows->local : linux->local linux->yarn: ...
- 自己制作winhex的模板
winhex有很多的官方模板,可以在网上下载(后缀tpl)并放至它的安装目录,即可使用.不过要是自己能自己制作,这才好玩,不是么?! 打开模板管理器,可以选中其中一个模板,下面有应用,有编辑,你点开编 ...