22292_HippityHopscotc

2022-5-16 18:21| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506297012400-Problem List-采集的数据-后羿采集器.html

Pro.ID

22292

Title

Hippity Hopscotch

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22292

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

  • Time Limit: 900/300 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    The game of hopscotch involves chalk, sidewalks, jumping, and picking things up. Our variant of hopscotch involves money as well. The game is played on a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. Each grid location has on it a stack of between 0 and 100 pennies.

    A contestant begins by standing at location (0,0). The contestant collects the money where he or she stands and then jumps either horizontally or vertically to another square. That square must be within the jumping capability of the contestant (say, k locations) and must have more pennies than those that were on the current square.

    Given n, k, and the number of pennies at each grid location, compute the maximum number of pennies that the contestant can pick up before being unable to move.

    输入

  • a line containing two integers between 1 and 100: n and k
  • n lines, each with n numbers: the first line contains the number of pennies at locations (0, 0) (0, 1) ... (0, n-1); the next line contains the number of pennies at locations (1, 0), (1, 1), ... (1, n-1), and so on.
  • 输出

    Description
    The game of hopscotch involves chalk, sidewalks, jumping, and picking things up. Our variant of hopscotch involves money as well. The game is played on a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. Each grid location has on it a stack of between 0 and 100 pennies.

    A contestant begins by standing at location (0,0). The contestant collects the money where he or she stands and then jumps either horizontally or vertically to another square. That square must be within the jumping capability of the contestant (say, k locations) and must have more pennies than those that were on the current square.

    Given n, k, and the number of pennies at each grid location, compute the maximum number of pennies that the contestant can pick up before being unable to move.

    Input
  • a line containing two integers between 1 and 100: n and k
  • n lines, each with n numbers: the first line contains the number of pennies at locations (0, 0) (0, 1) ... (0, n-1); the next line contains the number of pennies at locations (1, 0), (1, 1), ... (1, n-1), and so on.
  • Output
    a single integer giving the number of pennies collected
    Sample Input
    3 1
    1 2 5
    10 11 6
    12 12 7
    Sample Output
    37
    Source

    样例输入

    3 1
    1 2 5
    10 11 6
    12 12 7

    样例输出

    37

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部