码迷,mamicode.com
首页 > 其他好文 > 详细

HOJ 2713 Matrix1

时间:2016-12-11 17:40:35      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:include   asi   code   block   hit   stat   独立   print   box   

Matrix1

My Tags   (Edit)
  Source : Classical Problem
  Time limit : 5 sec   Memory limit : 64 M

Submitted : 424, Accepted : 129

Lilu0355 is a thoughtful boy and always plays a classical mathematic game.The game plays like that, there is a n * m matrix, each grid of this matrix is filled with a non-negative number. You should remove some numbers from the matrix and make sure that any two numbers removed are not adjacent in the matrix. What is the biggest sum of those removed numbers? Lilu can always find the answer, can you?

 

Input

 

The first line is a integer T indicating the number of test cases.T cases fllows. Each case includs two integers n, m(m ≤ 50,n ≤ 50) and n * m non-negative integers, which is not more than 40000.

 

 

Output

 

For each test case, output the biggest sum.

 

 

Sample Input

 

 

1
3 2
180 25
210 45
220 100

 

 

Sample Output

 

 

445

 

HOJ 2713 Matrix1

标签:include   asi   code   block   hit   stat   独立   print   box   

原文地址:http://www.cnblogs.com/neighthorn/p/6159817.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!