https://codeforces.com/contest/1141/problem/B

题解:复制一遍数组,找最大的连续1

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=400000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,q;
int ans,cnt,flag,temp,sum;
int a[N];
char str;
struct node{};
int main()
{
#ifdef DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout);
#endif//ios::sync_with_stdio(false);//cin.tie(0);//cout.tie(0);//scanf("%d",&t);//while(t--){scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&a[i]);a[i+n]=a[i];}for(int i=1;i<=2*n;i++){if(a[i]){cnt++;}else{ans=max(ans,cnt);cnt=0;}}ans=max(ans,cnt);cout<<ans<<endl;//}#ifdef DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}

Maximal Continuous Rest相关推荐

  1. 2019.4.30 WAGV CF Team replay

    前言 4月30号的2小时CF重现赛,基本都是DIV2的水题,目标是训练CF题目的题感来上分,主要是读英文题有困难,对题意理解困难- 比赛地址:https://cn.vjudge.net/contest ...

  2. 经典算法题之Maximal Square

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 作者:叶    虎 Maximal Square是道非常有意思的算 ...

  3. Error: Discrete value supplied to continuous scale

    Error: Discrete value supplied to continuous scale 目录 Error: Discrete value supplied to continuous s ...

  4. R语言问题解决:Error: Discrete value supplied to continuous scale

    R语言问题解决:Error: Discrete value supplied to continuous scale #仿真数据 set.seed(123) my_df1 <- data.fra ...

  5. ERROR while rich displaying an object: Error: Continuous value supplied to discrete scale

    ERROR while rich displaying an object: Error: Continuous value supplied to discrete scale 目录 ERROR w ...

  6. 有序标称变量(Categorical Features)编码为数值变量(Continuous Features​​​​​​​)详解及实践

    有序标称变量(Categorical Features)编码为数值变量(Continuous Features)详解及实践 有一个带顺序的分类特征(例如,高.中.低) 使用pandas DataFra ...

  7. 标称变量(Categorical Features)或者分类变量(Categorical Features​​​​​​​)编码为数值变量(Continuous Features​​​​​​​)

    标称变量(Categorical Features)或者分类变量(Categorical Features)编码为数值变量(Continuous Features)或者数值变量(Numeric Fea ...

  8. Jabba: hybrid error correction for long sequencing reads using maximal exact matches机译:Jabba:使用最大精

    Jabba: hybrid error correction for long sequencing reads using maximal exact matches 机译:Jabba:使用最大精确 ...

  9. LeetCode 221. Maximal Square----动态规划--谷歌面试算法题--Python解法

    题目地址:Maximal Square - LeetCode Given a 2D binary matrix filled with 0's and 1's, find the largest sq ...

最新文章

  1. C语言之通过指针变量访问整型变量
  2. CSS之expression
  3. mysql log table_mysqlbinlog功能扩展--table参数
  4. layui 流加载flow遇到的问题
  5. 包装类型与基本类型的装箱与拆箱操作
  6. 不小心合并了icloud通讯录_苹果手机怎么恢复通讯录联系人号码?原来方法竟如此简单!...
  7. nodejs原始连接mysql
  8. Flutter之Windows环境搭建
  9. C++中的模板那点事
  10. HTML data-* 自定义属性
  11. Spring知识点总结
  12. KELL代码加速度传感器计算角度
  13. amos里CFA可行性辨别结果怎么看_AMOS 中验证性因素分析(CFA)
  14. (二十)美萍酒店管理系统:系统维护_系统设置_房间类型_单个添加、多个添加
  15. 上海大学计算机考证时间表
  16. 计算机表格折线图添加图例,如何将Excel表格中插入的折线图中的圆圈设置为方块或三角形...
  17. 图形 3.6 纹理压缩——包体瘦身术——RGBA与ASTC与ETC2压缩与实际对比体验
  18. 如何用python做比分网_使用python对历届世界杯进行数据分析
  19. Docker简介/安装/使用
  20. C语言:正负交替的问题

热门文章

  1. 修改图片背景_用P图软件将图片背景更改
  2. kmeans中的k的含义_聚类的Python实现(二):确定分群数K
  3. fckeditor 漏洞php,fckeditor上传漏洞利用总结
  4. access 记录集 filter find属性_《另一个伊甸》超越时空的猫时之塔阵容推荐 时之塔BOSS属性怎么打_另一个伊甸...
  5. 曲线均匀分布_R——概率统计与模拟(三) 变换均匀分布对特定分布进行抽样
  6. c++提供的可有效分配对象空间的运算符是_Python 为什么不支持 i++ 自增语法,不提供 ++ 操作符?
  7. matlab 里的mod,matlab中mod()函数究竟有什么用?具体的作用(不要告诉我怎么算,我只想知道他有什么用)...
  8. python必刷面试_Python面试必刷题系列(5)
  9. 港科大陈凯、杨强教授新书重磅发布,系统揭秘隐私计算 | 文末送书
  10. EMNLP 2021 | 正则表达式与神经网络的深度融合(续)