哈哈哈哈a @ 2021-07-29 17:32:05
#include <bits/stdc++.h>
using namespace std;
char a[40100];
int main(){
int n=1,h,l;
char g;
int f=1;
while(cin>>g)
{
if(g=='1'||g=='0')
{
a[n]=g;
n++;}
}
n--;
cout<<sqrt(n)<<" ";
for(int h=1;h<=n;h++)
if(a[h]!='1'&&a[h]!='0')
return 0;
else if(a[h]==a[h+1])f++;
else
{
cout<<f<<" ";
f=1;}
return 0;}
by lion0514 @ 2021-07-29 17:33:37
程序可读性太差,建议修改
by 哈哈哈哈a @ 2021-07-29 18:21:34
@哈哈哈哈a
#include <bits/stdc++.h>
using namespace std;
char a[40100];
int main(){
int n=1,h,l;
char g;
int f=1;
while(cin>>g)
{
a[n]=g;
n++;}
n--;
cout<<sqrt(n)<<" ";
for(int h=1;h<=n;h++)
if(a[h]==a[h+1])f++;
else
{
cout<<f<<" ";
f=1;}
return 0;}
by 一只白熊bear @ 2021-07-29 20:10:36
格式看着好难受
by 庄nnnn额 @ 2021-08-11 21:02:59
@哈哈哈哈a Tab位有多贵啊,省着它干嘛?