TQYMWY @ 2020-02-13 14:26:41
python 3全RE
matrix = []
line = input()
matrix.append(line)
n = len(line)
for i in range(n - 1):
matrix.append(input())
print(n, end = ' ')
flag = '0'
count = 0
for i in range(n):
for j in range(n):
if matrix[i][j] == flag:
count += 1
else:
print(count, end = ' ')
count = 1
flag = matrix[i][j]
print(count)
by Thomas_ @ 2020-02-13 14:50:33
c++好评
by sheriff @ 2020-03-20 00:36:46
我也遇到同样的问题了,在本地没有问题,在线IDE调试也成功,交上洛谷,就失败了。
by FrancisBonnefoy @ 2020-04-04 11:31:14
读入矩阵那里应该是range(n)吧?
by aaki @ 2020-04-11 09:06:24
@TQYMWY 这是由于linux的回车换行和windows系统下的不一致造成的