2AC 8WA蒟蒻求救!
查看原帖
2AC 8WA蒟蒻求救!
339299
osfly楼主2021/2/5 20:40
#include<cstdio>
char ch;
char last='a';
int ysm[40000];
int tot=-1;
int cnt;
int cal;
bool flag;
int main()
{
	for(int i=0;i<40000;i++) ysm[i]=1;
	while(~scanf("%c",&ch))
	{
		if(ch!='\n'&&ch!='\r')
		{
			if(ch=='1'&&cnt==0) tot++;
			if(last!=ch)
			{
				last=ch;
				tot++;
			}
			else ysm[tot]++;
			cnt++;
		}
		else if(!flag)
		{
			cal=cnt;
			flag=true;
		}
	}
	printf("%d ",cal);
	for(int i=0;i<=tot;i++) printf("%d ",ysm[i]);
	return 0;
}
2021/2/5 20:40
加载中...