番兵付きの一次元配列
code:python
C = np.zeros((H + 2, W + 2), np.bool_)
C = C.ravel()
H += 2
W += 2
ValueError: could not broadcast input array from shape (3,0) into shape (3,5)
already read all data from stdin
各ステップ解説
code:python
>> np.frombuffer(b"...\n.@.\n...\n", "S1")
array([b'.', b'.', b'.', b'\n', b'.', b'@', b'.', b'\n', b'.', b'.', b'.',
b'\n'], dtype='|S1')
>> _.reshape(3, -1)
>> _ == b"."
>> C = np.zeros((3 + 2, 3 + 2), np.bool_)
>> C
>> C.ravel()
array([False, False, False, False, False, False, True, True, True,
False, False, True, False, True, False, False, True, True,
True, False, False, False, False, False, False])