51nod 1049【经典】
来源:互联网 发布:h5 微信订餐系统源码 编辑:程序博客网 时间:2024/06/13 03:25
自己模拟,全靠体会~
#include <cstdio>#include <stack>#include <iostream>#include <string.h>#include <algorithm>using namespace std;typedef long long LL;const int N=5e4+10;LL a[N];int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lld",&a[i]); LL ans=a[1]; LL d=a[1]; for(int i=2;i<=n;i++) { if(d<0) d=a[i]; else d+=a[i]; if(d>ans) ans=d; } printf("%lld\n",ans); return 0;}
0 0
- 51nod 1049【经典】
- 51nod 1183编辑距离 经典dp
- 51Nod 1021 石子归并(经典dp)
- 经典问题:流水线调度(51nod)
- 51nod 1134 最长递增子序列 dp(经典)
- 51nod 1449 砝码称重(经典贪心+进制)
- 51nod 1672 区间交 (经典贪心)
- 51Nod
- 51Nod
- 51nod
- 51Nod
- 51Nod
- 51Nod
- 51Nod
- 51Nod
- 51Nod
- 51Nod
- 51Nod
- weex环境配置快速上手
- 网络编程之UDP协议
- Java枚举的七种常见用法
- BASH自学笔记-变量
- 解决RocketMQ报No route info of this topic:异常
- 51nod 1049【经典】
- bzoj2964 Boss单挑战
- 第九周 OJ-1
- Topcoder SRM 701 Div2 900 ThueMorseGame
- macOS 使用经验总结
- 第九周OJ总结<3>-切面条
- android常用控件ViewPager(一) ViewPager基本应用
- Java Socket图片文件传输
- poj1064(二分处理浮点类型技巧)