Problem 2879 --1.5.1 Number Triangles

2879: 1.5.1 Number Triangles

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $4$ 正确数量 $5$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 usaco 动态规划

Consider the number triangle shown below. Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right.

          7

        3   8

      8   1   0

    2   7   4   4

  4   5   2   6   5

In the sample above, the route from 7 to 3 to 8 to 7 to 5 produces the highest sum: 30.

PROGRAM NAME: numtri

The first line contains R (1 <= R <= 1000), the number of rows. Each subsequent line contains the integers for that particular row of the triangle. All the supplied integers are non-negative and no larger than 100. 
A single line containing the largest sum using the traversal specified. 
5
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5

30

推荐代码 查看2879 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$45 $ms] AOJ大管家 445511 2019-06-22 23:02:36
内存最少[$0 $KB] 只能过个样例~~~ 602027 2020-06-24 21:41:33
第一AC AOJ大管家 445511 2019-06-22 23:02:36
第一挑战 AOJ大管家 445511 2019-06-22 23:02:36

赛题来源/所属竞赛 usaco training usaco Training

竞赛编号 竞赛名称 竞赛时间 访问比赛