• [1443] Weiqi

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Have you ever played Weiqi?
    In a composition, there exist two kinds of chess pieces black and white.
    The problem is so easy, can you find out how many white pieces are encircled by blacks?

  • 输入
  • First line will contain two integers M and N (3 <= M, N <= 100), means the size of the composition.
    Then M lines, each line N integers only including '1', '2', and '0' ('1' represent black piece, '2' represent white piece and '0' represent empty).
  • 输出
  • Print how many white pieces are encircled by black.
  • 样例输入
  • 4 4
    0012
    0121
    0111
    0101
    4 4
    0012
    0121
    0101
    0111
    
  • 样例输出
  • 1
    0
    
  • 提示
  • 详情看样例输入输出
  • 来源
  • Hungar
  • 操作

显示春菜