You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
633 B
23 lines
633 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 210;
|
|
string a[N]; //注意这里的是字符串数组!
|
|
int sum;
|
|
int main() {
|
|
cin >> a[0];
|
|
int n = a[0].size();//获取字符串的长度
|
|
for (int i = 1; i < n; i++) cin >> a[i];
|
|
printf("%d ", n);
|
|
char c = '0';
|
|
for (int i = 0; i < n; i++)
|
|
for (int j = 0; j < n; j++)
|
|
if (a[i][j] == c) sum++;
|
|
else {
|
|
printf("%d ", sum);
|
|
if (c == '0') c = '1'; else c = '0';
|
|
sum = 1;
|
|
}
|
|
//输出最后的个数
|
|
printf("%d ", sum);
|
|
return 0;
|
|
} |