shelbyloveshiking @ 2024-11-19 19:42:39
#include <stdio.h>
int main ()
{
int mtr[200][200];
int N;
int * ptr;
for (int i=0; ;i++)
{
for (int j=0; ;j++)
{
int medium;
medium = getchar() - 48;
if (medium == 0 || medium == 1)
mtr[i][j] = medium;
else
{
N = j;
break;
}
}
if (i == N-1)
break;
}
int newmtr[N][N];
for (int i=0;i<N;i++)
{
for (int j=0;j<N;j++)
newmtr[i][j] = mtr[i][j];
}
printf ("%d ",N);
ptr = &newmtr[0][0];
while (1)
{
int count = 1;
while (*ptr ^ *(ptr+1) == 0)
{
count ++;
ptr ++;
}
if (ptr + 1 > newmtr[0] + N*N - 1)
printf ("%d",count);
else
printf ("%d ",count);
ptr ++;
if (ptr > newmtr[0] + N*N - 1)
break;
}
return 0;
}