#P1451. 求细胞数量
求细胞数量
Description
A rectangular array consists of digits to . Digits to denote cells. Two positions belong to the same cell if, moving up, down, left, or right through positions with cell digits, they are connected. Given the array, count the number of cells.
Input Format
The first line contains two integers and .
The next lines each contain a string of length consisting only of characters 0 to 9, representing the matrix.
Output Format
Output a single integer, the number of cells.
4 10
0234500067
1034560500
2045600671
0000000089
4
Hint
Constraints
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号