2 solutions

  • 0
    @ 2025-9-13 9:25:18

    这题把字符串(a)输入,然后再遍历一遍把单次0串(l)和最大0串(max1)比一下大小就可以了

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int l=0,max1=0;
    	string a;
    	cin>>a;
    	for(int i=0;i<a.size();i++){
    		if(a[i]=='0'){
    			l++;
    		}
    		else if(l>0){
    			if(l>max1){
    				max1=l;
    			}
    			l=0;
    		}
    	}
    	cout<<max1;
    	return 0;
    }
    ```
    
    
    ```

    Information

    ID
    1026
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    31
    Accepted
    10
    Uploaded By