当前位置: 首页 > news >正文

电子商务网站基本功能建设银行大学华东学院网站

电子商务网站基本功能,建设银行大学华东学院网站,哪家建设公司宣传搞得好,网站建设及售后服务的说明书题干#xff1a; N个整数组成的循环序列a[1],a[2],a[3],…,a[n]#xff0c;求该序列如a[i]a[i1]…a[j]的连续的子段和的最大值#xff08;循环序列是指n个数围成一个圈#xff0c;因此需要考虑a[n-1],a[n],a[1],a[2]这样的序列#xff09;。当所给的整数均为负数时和为0。…题干 N个整数组成的循环序列a[1],a[2],a[3],…,a[n]求该序列如a[i]a[i1]…a[j]的连续的子段和的最大值循环序列是指n个数围成一个圈因此需要考虑a[n-1],a[n],a[1],a[2]这样的序列。当所给的整数均为负数时和为0。 例如-2,11,-4,13,-5,-2和最大的子段为11,-4,13。和为20。 收起 输入 第1行整数序列的长度N2 N 50000) 第2 - N1行N个整数 (-10^9 S[i] 10^9) 输出 输出循环数组的最大子段和。 输入样例 6 -2 11 -4 13 -5 -2 输出样例 20 解题报告 模板了。 AC代码 #include bits/stdc.h using namespace std; typedef long long LL; const int INF 0x3f3f3f3f; const LL mod 1e9 7; const int N 200005; int a[N]; LL pre[N]; int main() {int n;scanf(%d, n);for (int i 1; i n; i) {scanf(%d, a[i]);a[n i] a[i];}for (int i 1; i 2 * n; i) {pre[i] pre[i - 1] a[i];}dequeint q;q.push_back(0);LL ans a[1];for (int i 1; i 2 * n; i) {if (!q.empty() q.front() i - n) {q.pop_front();}if(pre[i] - pre[q.front()] ans) {ans pre[i] - pre[q.front()];}else {while (!q.empty() pre[q.back()] pre[i]) {q.pop_back();}}//ans max(ans, pre[i] - pre[q.front()]);q.push_back(i);}printf(%lld\n, ans);return 0; } 或者 #include bits/stdc.h using namespace std; typedef long long LL; const int INF 0x3f3f3f3f; const LL mod 1e9 7; const int N 200005; int a[N]; LL pre[N]; int main() {int n;scanf(%d, n);for (int i 1; i n; i) {scanf(%d, a[i]);a[n i] a[i];}for (int i 1; i 2 * n; i) {pre[i] pre[i - 1] a[i];}dequeint q;q.push_back(0);LL ans a[1];for (int i 1; i 2 * n; i) {if (!q.empty() q.front() i - n) {q.pop_front();}ans max(ans, pre[i] - pre[q.front()]);while (!q.empty() pre[q.back()] pre[i]) {q.pop_back();}q.push_back(i);}printf(%lld\n, ans);return 0; } 另一个做法 https://blog.csdn.net/weixin_41544329/article/details/85076111
http://www.yutouwan.com/news/29986/

相关文章:

  • 二建转注辽宁建设主管部门网站医院网站后台模板
  • 做rap的网站内蒙建设信息网站
  • 公司网站开发交接注意事项vip视频网站怎么做
  • 站外推广方式有哪些江门网站推广优化
  • 公司推广做哪个网站晚上做设计挣钱的网站
  • 嘉兴网站制作网站建设wordpress代码解释
  • 网站的规划和建设重庆大江建设工程集团有限公司
  • 建公司网站建设明细报价表食品网站开发
  • 上海住房与建设部网站网站做二维码
  • 学习做网站的wordpress 插件 活动
  • 网站开发 前端 后端 如何结合wordpress上百人
  • 如何做交互式网站做中医诊所网站
  • vue 网站开发wordpress报名系统
  • 整站seo包年费用北京的网页设计
  • 网站建设邀标比选dw 8做的网站怎么上传
  • 神马站长平台网站建实例
  • 网站集群建设必要性苏州钻木网络科技有限公司
  • 推广网站平台免费搜索推广是什么意思
  • 卖网站怎样做如何使用网站模板
  • 商标设计网站排行广告设计公司简介内容
  • 做网站 sql 用哪种剪辑师培训班有用吗
  • 全球网站建设服务商广东省建设工程质量安全监督检测总站网站
  • o2o网站建设特色网站建设误区
  • 上海优化网站价格wordpress阿里云主机
  • 怎么做废品网站最大的开源网站
  • 东莞网站公司哪家好建设网站企业
  • 天津塘沽网站建设广东住房和城乡建设厅网站首页
  • 超链接对做网站重要吗wordpress图片文章
  • 旅游网站建设网站电子商务网站建设与维护读书心得
  • 微信网站如何制作软件延吉网站建设公司哪家好