自己模拟,全靠体会~

#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;
}

最新文章

  1. Java演算法之堆排序(HeapSort)
  2. jQuery弹出窗口浏览图片
  3. sql 截取日期
  4. Java多线程系列--“JUC原子类”03之 AtomicLongArray原子类
  5. Apache2.2+php5.4在windows上配置实例
  6. Android中解析JSON格式数据常见方法合集
  7. 黑马程序员 Java基础&lt;九&gt;---&gt; 多线程
  8. linux 内核睡眠与唤醒
  9. web开发路径问题
  10. iOS极光推送SDK的使用流程
  11. [NOIP2002]字串变换 T2 双向BFS
  12. Linux 纯字符界面的玩法
  13. kubernetes系列07—Pod控制器详解
  14. java中去除字符串(String)中的换行字符(\r \n \t)
  15. bit、Byte、bps、Bps、pps、Gbps的单位详细说明及换算
  16. php 下载完成后删除文件
  17. FPGA中IBERT核的应用(转)
  18. QueryString to Dictionary&lt;string, string&gt;
  19. mongodb中Gson和java##Bean对象转化类
  20. java web程序启动加载 ContextLoaderListener

热门文章

  1. Eclipse-----Eclipse断点调试
  2. appium(6)-parts of appium api
  3. (转)C++ STL set() 集合
  4. 人生苦短之Python类的一二三
  5. linux系统配置之PATH环境变量的设置(centos)
  6. apache web 服务器
  7. 更换ubuntu apt-get源
  8. CQOI2017 部分题解
  9. [TJOI2016 &amp; HEOI2016] 字符串
  10. NVIDIA GPU 计算能力