前缀和维护
人工智鸭
这个作者很懒,什么都没留下…
展开
-
L-add one (动态规划)
You are given an integernn. You have to applymmoperations to it. In a single operation, youmustreplace every digitddof the number with the decimal representation of integerd+1. For example,1912becomes21023after applying the operation once. Yo...原创 2022-02-06 17:25:15 · 339 阅读 · 0 评论 -
最长连续子序列和(二维前缀和维护加滑动窗口优化)
题意 给你一个长度为 n 的整数序列 {A1,A2,⋯,An},要求从中找出一段连续的长度不超过 m 的非空子序列,使得这个序列的和最大。 输入格式 第一行为两个整数 n,m; 第二行为 n个用空格分开的整数序列,每个数的绝对值都小于 1000。 输出格式 仅一个整数,表示连续长度不超过 m 的最大非空子序列和。 0<=n,m<2e5 思路 这道题显然用暴力搜索二重循环会爆时间,时间复杂度大概为O(n*m)。显然要进行优化,而对于每一段连续的子序列的和都可以.原创 2022-01-21 23:08:20 · 529 阅读 · 0 评论