• [1296] Between The Island

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Death-Moon loves telling stories.
    Some days ago, he told us a scaring story.


    Long long ago, there were many ghosts living in each island.

    Humans wanted to wipe out the ghosts, so they began to build bridges to link all islands, either connecting directly or not directly.

  • 输入
  • Input until EOF.
    Input two positive integers M(1 <= M <= 55) and N(1 <= N <= 55) means the map. Then follows M lines, each line includes N characters only includes zero and '+', zero means a part of the island, '+' means a part of sea.
  • 输出
  • You should output the minimum number of bridges should be built.
  • 样例输入
  • 5 6
    000000
    00+++0
    +++0+0
    ++000+
    0+0000
  • 样例输出
  • 2
  • 提示
  • 来源
  • hungar
  • 操作

显示春菜