acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 竞赛
  • 讨论
  • 团队
登录
注册
题目详情提交记录(0)
  • l0ng lOng

    userId_undefined

    礼堂钉针

    103阅读
    1回复
    0点赞
  • 题解

    记得开long long

    userId_undefined

    沈思邈

    时空双修者题解仙人荣耀黄金快乐小狗CSP-J一等奖GESP8级
    61阅读
    0回复
    3点赞
  • 不开long long见祖宗

    userId_undefined

    WA君

    题解仙人秩序白银快乐小狗空间掌握者时空双修者时间刺客
    9阅读
    0回复
    2点赞
  • (觉得有用就点赞)

    #include<bits/stdc++.h> using namespace std; typedef long long ll; int n; string s; int main(){ int t; cin>>t; while(t--){ cin>>n>>s; ll m1=0,m0=0; ll s1=0,s0=0; ll cnt1=0,cnt0=0; for(int i=0;i<n;i++){ if(s[i]=='1'){ cnt1++; s1++; s0=0; } else{ cnt0++; s0++; s1=0; } m1=max(m1,s1); m0=max(m0,s0); } cout<<max(max(m1m1,m0m0),cnt1*cnt0)<<"\n"; } return 0; }

    userId_undefined

    我是团子129(互关)

    出道萌新8月全勤卷王倔强青铜时间刺客空间掌握者贪心·贪心尝试者
    12阅读
    0回复
    1点赞
  • 不是哥们,这对吗

    userId_undefined

    科技起源

    出道萌新秩序白银GESP5级时空双修者快乐小狗
    11阅读
    0回复
    0点赞
  • 题解

    注意:xy,xx,y*y可能会超出int范围,所以要开long long

    userId_undefined

    skirmish

    8月全勤卷王时空双修者出道萌新CSP-J一等奖BUG超度大师秩序白银
    7阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页