文章

1

粉丝

0

获赞

0

访问

13

头像
字符串区间翻转 题解:
P1642 杭州电子科技大学/南京大学机试题
发布于2026年2月25日 21:38
阅读数 13

#include<bits/stdc++.h>
using namespace std; 

int main() {
    int n;
    while(cin>>n)
    {
        int count = 0;//统计翻转区间能增加的1 
        int max0 = 0;//最大 
        int all = 0;//所有的1 
        string s;
        cin>>s;
        for(int i=0;i<n;i++)
        {
            char cur = s[i];
            if(cur == '1' && count == 0){ 
                all++;
            }else if(cur == '1' && count!=0){
          ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发