MCITYHAL - Repair City Hall
Tác giả: happyboy99x
Ngôn ngữ: C++
#include<cstdio>
#define N 200
char s[N+1][N+1];
int c[N+1], m, n;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
scanf("%d%d",&m,&n);
for(int i = 0; i < m; ++i) scanf("%s", s[i]);
for(int j = 0; j < n; ++j) {
for(int i = 0; i < m; ) {
if(s[i][j] == 0x31) ++i;
else {
int st = i;
for(; i < m && s[i][j] == 0x30; ++i);
++c[i - st];
}
}
}
for(int i = 1; i <= m; ++i)
if(c[i]) printf("%d %d\n", i, c[i]);
return 0;
}