4087: 【例65.3】 细胞个数
Memory Limit:64 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:51
Solved:27
Description
一矩形阵列由数字$0$到$9$组成,数字$1$到$9$代表细胞,细胞的定义为沿细胞数字上下左右还是细胞数字则为同一细胞,求给定矩形阵列的细胞个数。如:
阵列。
阵列。
4 10 0234500067 1034560500 2045600671 0000000089有$4$个细胞。
Input
第一行为矩阵的行$n(1≤n≤100)$,列$m(1≤m≤100$)。
下面为一个$n \times m$的矩阵。
下面为一个$n \times m$的矩阵。
Output
细胞个数。
Sample Input Copy
4 10
0234500067
1034560500
2045600671
0000000089
Sample Output Copy
4