求助,案例5WA,其他能AC
查看原帖
求助,案例5WA,其他能AC
859613
ENE574楼主2023/9/22 09:20
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const int maxn=1e5;
void solve() {
    int n=0,past=0,mark=0;
    string s,str="";
    while(1){
        cin>>s;
        if(cin.eof()){
            break;
        }
        str+=s;
        n++;
    }
    cout<<n<<" ";
    for(int i=0;i<n*n;i++){
        if(str[i]-'0'!=mark){
            cout<<i-past<<" ";
            past=i;
            mark^=1;
        }
    }
    cout<<n*n-past;
}
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    int T=1;
    //cin >> T;
    while(T--){
        solve();
    }
    return 0;
}

2023/9/22 09:20
加载中...