当前位置:网站首页>【dp】数字三角形
【dp】数字三角形
2022-07-24 05:15:00 【rejudge】
https://www.acwing.com/problem/content/900/
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1100;
int v[N][N];
int f[N][N];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
cin>>v[i][j];
for(int i=1;i<=n;i++) f[n][i]=v[n][i];
for(int i=n-1;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
f[i][j]=max(f[i+1][j],f[i+1][j+1])+v[i][j];
}
}
cout<<f[1][1];
return 0;
}
边栏推荐
- Problems encountered in configuring Yum source
- jdbc的增删改查
- The opening ceremony of the 2022 Huawei developer competition in China kicked off!
- Learning pyramid context encoder network for high quality image painting paper notes
- 智能指针、左值引用右值引用、lambda表达式
- Theoretical basis of machine learning
- Some thoughts about blogger coach soserious
- MySQL transaction and its problems and isolation level
- Using a* heuristic search to solve maze routing problem
- 连接数%的准确率。现在拟需求。企业在数足以
猜你喜欢

熊市抄底指南

XML schema

Do you want to have a robot that can make cartoon avatars in three steps?

Bear market bottoming Guide

JMeter upload and download files

Ia notes 2

Image painting for irregular holes using partial revolutions paper notes

Binary SCA fingerprint extraction black Technology: go language Reverse Technology

Recursive cascade network: medical image registration based on unsupervised learning

Heavy! The 2022 China open source development blue book was officially released
随机推荐
网NN计算能主机系统资e提供的NTCP
Drools 开发决策表
NFS shared services
[deep learning] (III) image classification
【sklearn】RF 交叉验证 袋外数据 参数学习曲线 网格搜索
Ia notes 2
利用a*启发式搜索解决迷宫寻路问题
编译型语言和解释型语言的区别
明星逆市入局的NFT,如何能走出独立行情?
Read "effective managers - Drucker"
MySQL连接
使用swagger2markup生成API文档
Knowledge record of College Physics C in advance in summer [update]
Tips for using BeanShell built-in variable prev
PXE efficient batch network installation
反射的介绍
How can NFT, whose stars enter the market against the market, get out of the independent market?
【sklearn】数据预处理
Recursive cascade network: medical image registration based on unsupervised learning
Pointer learning diary (V) classic abstract data types and standard function libraries