博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 2084 数塔
阅读量:4623 次
发布时间:2019-06-09

本文共 828 字,大约阅读时间需要 2 分钟。

没什么好说的,这是我学DP的第一道题目。

 

1 //#define LOCAL 2 #include 
3 #include
4 #include
5 #include
6 using namespace std; 7 8 int a[103][103]; 9 10 int main(void)11 {12 #ifdef LOCAL13 freopen("2084in.txt", "r", stdin);14 #endif15 16 int C;17 scanf("%d", &C);18 while(C--)19 {20 int n;21 scanf("%d", &n);22 int i, j;23 for(i = 1; i <= n; ++i)24 for(j = 1; j <= i; ++j)25 scanf("%d", &a[i][j]);26 27 for(i = n-1; i >= 1; --i)28 for(j = 1; j <= i; ++j)29 a[i][j] += max(a[i+1][j], a[i+1][j+1]);30 31 printf("%d\n", a[1][1]);32 }33 return 0;34 }
代码君

 

转载于:https://www.cnblogs.com/AOQNRMGYXLMV/p/3877007.html

你可能感兴趣的文章
三月23日测试Fiddler
查看>>
20171013_数据库新环境后期操作
查看>>
SpringMVC中文件的上传(上传到服务器)和下载问题(二)--------下载
查看>>
Socket & TCP &HTTP
查看>>
osip及eXosip的编译方法
查看>>
Hibernate composite key
查看>>
[CF Round #294 div2] D. A and B and Interesting Substrings 【Map】
查看>>
keepalived+nginx安装配置
查看>>
我的2015---找寻真实的自己
查看>>
android编译遇到问题修改
查看>>
解决Ubuntu18.04.2远程桌面Xrdp登录蓝屏问题
查看>>
Git的安装和使用教程详解
查看>>
lsof命令详解
查看>>
常用模块,异常处理
查看>>
父窗口与子窗口之间的传值
查看>>
eclipse 找不到 tomcat 的解决方案
查看>>
HDU 1890--Robotic Sort(Splay Tree)
查看>>
connection string for Excel/Access 2010
查看>>
【转】【Python】Python中的__init__.py与模块导入(from import 找不到模块的问题)
查看>>
学习wavenet_vocoder之环境配置
查看>>