0分蒟蒻求调,样例全过,提交全WA
查看原帖
0分蒟蒻求调,样例全过,提交全WA
1219873
Wuzetong楼主2024/8/23 10:14
#include<bits/stdc++.h>
using namespace std;
string tostring(int n){
    if(n==0) return "0";
    string s;
    while(n){
        s+=n%10+48;
        n/=10;
    }
    reverse(s.begin(),s.end());
    return s;
}
int main(){
    int n,cnt=0;
    char a,s='0';
    string ans;
    while(cin>>a){
        if(a!=s){
            ans+=" "+tostring(cnt);
            cnt=0;
            s=a;
        }
        cnt++;
        n++;
    }
    ans+=" "+tostring(cnt);
    cout<<(int)sqrt(n)<<ans;
    return 0;
}
2024/8/23 10:14
加载中...