B3811自己做法70分
  • 板块题目总版
  • 楼主I_AM_SB_
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/7/17 17:54
  • 上次更新2023/11/3 09:17:28
查看原帖
B3811自己做法70分
940136
I_AM_SB_楼主2023/7/17 17:54
#include <bits/stdc++.h>
using namespace std;
string a;
long long maxn=-1e8,l,r,cnt,now;
int main()
{
    cin>>a;
    l=0;
    r=a.length()-1;
    while(a[l]=='0')
    {
        l++;
    }
    now=r;
    while(now>l)
    {
        cnt=0;
        int lr=now;
        while(a[now]=='0'&&now>l)
        {
            now--;
            cnt++;
        }
        if(cnt>maxn)
        {
            maxn=cnt;
            r=lr;
        }
        now--;
    }
    for(int i=0;i<l;i++)
    {
        cout<<0;
    }
    for(int i=r;i>=l;i--)
    {
        cout<<a[i];
    }
    for(int i=r+1;i<=a.length()-1;i++)
    {
        cout<<a[i];
    }
    return 0;
}

大佬帮一下我球球了

2023/7/17 17:54
加载中...