zoukankan      html  css  js  c++  java
  • HOJ 2713 Matrix1

    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
    
  • 相关阅读:
    线段树、最短路径、最小生成树、并查集、二分图匹配、最近公共祖先--C++模板
    数据结构中各种树
    你必须知道的基本位运算技巧(状压DP、搜索优化都会用到)
    memset为int型数组初始化问题
    Dev-C++添加代码格式化(format source code)工具Artistic Style
    让vs IIS Express支持本地静态Json文件
    什么是「供给侧改革」? 原标题:中央提的“供给侧改革”是啥意思?有谁能解说下吗?
    PowerDesigner用法和技巧
    php 调用 web Server(短信接口示例)
    sae相关配置
  • 原文地址:https://www.cnblogs.com/neighthorn/p/6159817.html
Copyright © 2011-2022 走看看