7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calc
来源:互联网 发布:mac grapher 编辑:程序博客网 时间:2024/06/17 03:23
01.
#include<cstdio>
02.
#include<cstring>
03.
#include<algorithm>
04.
using
namespace
std;
05.
int
dp[110][110],num[110][110];
06.
int
main()
07.
{
08.
int
n;
09.
while
(~
scanf
(
"%d"
,&n))
10.
{
11.
memset
(dp,0,
sizeof
(dp));
12.
for
(
int
i=1;i<=n;i++)
13.
for
(
int
j=1;j<=i;j++)
14.
scanf
(
"%d"
,&num[i][j]);
15.
for
(
int
i=n;i>=1;i--)
16.
for
(
int
j=1;j<=i;j++)
17.
{
18.
dp[i][j]=max(dp[i+1][j],dp[i+1][j+1])+num[i][j];
19.
}
20.
printf
(
"%d\n"
,dp[1][1]);
21.
}
22.
return
0;
23.
}
阅读全文
0 0
- 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calc
- matlab中figure指令如果后面加1,2是什么意思,比如figure(1);figure(2)
- count the number of "1" in the binary figure
- codeforces----193A Cutting Figure
- CodeForces 193A Cutting Figure
- Codeforces 193A. Cutting Figure
- [python] annotation in a figure
- Write a program that prints the numbers from 1 to 100,but for multiples of three print “Fizz” inste
- Matlab 画图:大图中画小图,Plot a smaller figure in a figure
- Convert a Characteristic into a Key Figure (BEx)
- Q9.4 Write a method that returns all subsets of a set.
- 项目实战--PC端固定布局[4]之figure
- latex: 改变图的caption Figure 1:为 Fig. 1.
- Matlab Tricks(一)—— figure(1)
- latex: 改变图的caption Figure 1:为 Fig. 1.
- latex: 改变图的caption Figure 1:为 Fig. 1.
- Write a test program that creates a Person , Student , Employee , Faculty , and Staff , and invok
- a(n+2)-4a(n+1)+4a(n) = 0 现在知道a(0) = x, a(10^8) = y, 求a((10^8)/2)
- C#读取CSV文件并保存进数据库
- Linux 使用chattr设置文件属性
- 微信小程序——智能小秘“遥知之”源码分享(语义理解基于olami)
- 经典利用信号量实现同步的问题
- AOP数据库操作回滚配置
- 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calc
- CentOS6.5下Hadoop2.8.1编译
- 快速排序算法
- ubuntu 网易云音乐安装
- jquery
- Python笔记(四)--变量类型之字符串
- .NET漫游指南-004-在dataGrid中添加CheckBox支持单选,多选,全选功能
- extjs 数据之间的互转
- React Native启动简易思维导图