陌潇_stojk @ 2018-11-07 20:35:20
#include<iostream>
#include<cstdio>
using namespace std;
int cnt,a[9000002],b,cnt2=0;
int main()
{
int n;
while()
{
cin>>b;
a[0]=b;
if(b==a[i-1])
a[cnt]++;
if(b!=a[i-1])
{
cnt++;
a[cnt]++;
}
}
cout<<cnt<<" ";
for(int i=1;i<=cnt;i++)
cout<<a[i]<<" ";
return 0;
}
by Platelet_0u0 @ 2018-11-07 20:38:44
cin自带判断输入
by 陌潇_stojk @ 2018-11-07 20:41:18
问题是输入最后一个后不会跳出循环
by fmt931200363 @ 2018-12-07 19:32:55
同学,我也卡在这里了