• [1312] Just The Mice

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • XP loves eating meat very much, but in his home, There are a lot of mice!
    So he decided to build a number of unit wall whose length is 1. Any mouse can not cross the wall. Of course, one grid can only contain a mouse or a piece of meat. Now, he asks to place the minimum wall to protect the meat.


  • 输入
  • There are many cases.
    For every case:

    N and M(N,M<=200)
    then N*M matrix:
    0 is empty, and 1 is the meat , 2 is the mice.
  • 输出
  • For every case:

    First line output “Case k:”, k is the k-th case;
    The second line is the answer.
  • 样例输入
  • 4 6 
    0 0 1 0 0 1
    0 0 0 1 0 0
    0 1 1 0 0 2
    0 0 0 0 2 0
  • 样例输出
  • Case 1:
    4
    
  • 提示
  • 来源
  • 加多宝凉茶
  • 操作

显示春菜