are_you_sure @ 2024-08-19 00:19:47
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
string s;
int ans=0;
char now='h';//h是我的标记
bool p=1;
while(cin>>s){
if(p){cout<<s.size()<<' ';p=0;}
for(int i=0;i<s.size();i++){
if(now=='h'){now=s[i];ans++;continue;}
if(s[i]==now)ans++;
else{cout<<ans<<' ';ans=1;now=s[i];}
}
}
}
by guanzisheng2 @ 2024-08-19 07:46:18
#include<bits/stdc++.h>
using namespace std;
string a;
char c[205*205];
int n,ans,x;
char y='1';
int main(){
cin>>a;
n=a.size();
cout<<n;
for(int j=0;j<n;j++){
c[j]=a[j];
}
for(int i=1;i<(int)(a.size());i++){
cin>>a;
for(int j=0;j<n;j++) {
c[i*n+j]=a[j];
}
}
while(x<n*n){
if(y=='1'){
y='0';
}
else{
y='1';
}
while(c[x]==y&&x<n*n){
ans++;
x++;
}
cout<<" "<<ans;
ans=0;
}
return 0;
}
by shanxiwen @ 2024-08-19 07:56:03
@are_you_sure
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0); cout.tie(0);
string s;
int ans=0;
char now='0';//这里看题
bool p=1;
while(cin>>s){
if(p){cout<<s.size()<<' ';p=0;}
for(int i=0;i<s.size();i++){
// if(now=='h'){now=s[i];ans++;continue;}
if(s[i]==now)ans++;
else{cout<<ans<<' ';ans=1;now=s[i];}
}
}
if (ans!=0) cout<<ans;//这里注意
}
by AWAYS_FROM_OI @ 2024-08-19 07:58:52
@are_you_sure ac代码,求关
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
string s;
int ans=0,len=0;
char now='h';
bool p=1;
while(cin>>s){
if(p){cout<<s.size()<<' ';len=s.size();p=0;if(s[0]!='0')cout<<"0 ";}
//这里要特判,如果首位不是0,要先输出0
for(int i=0;i<s.size();i++){
if(now=='h'){now=s[i];ans++;continue;}
if(s[i]==now)ans++;
else{cout<<ans<<' ';ans=1;now=s[i];}
}
len--;
if(len==0){cout<<ans;}//最后要输出ans
}
return 0;
}
by are_you_sure @ 2024-08-19 10:29:57
@wangguandingding @xuruizhe150711 @shanxiwen 所以我违和WA
by AWAYS_FROM_OI @ 2024-08-19 10:30:26
@are_you_sure 看我注释
by are_you_sure @ 2024-08-19 10:32:21
typedef 违和 为何
by are_you_sure @ 2024-08-19 10:33:32
@wangguandingding 一罐