Home > Back-end >  To solve the
To solve the

Time:09-15

3.1 the title description
Enter a n * n digital matrix composed of 0 s and 1 s, the task is connected 1 set number of statistical interpretation: if a number 1 in another eight positions around the number 1 on any (out), then they are connected, can constitute a part of a connected group,
3.2 input format
Line 1 to enter a positive integer n (n 300) or less, and then n lines, each line is a string of 0 or 1,
3.3 the output format
The number of connected group
3.4 input sample
4, 0011, 0010, 0000, 1100
3.5 the output sample
2
  • Related