maximum 10827 torus sum
Leetcode Hot 100 & 239. Sliding Window Maximum
参考资料: Python文档heapq部分 考点:子串 & [题干] 1 Input: nums = [1,3,-1,-3,5,3,6,7], k = 3 2 Output: [3,3,5,5,6,7] 3 Explanation: 4 Window position Max 5 6 [1 3 -1 ......
CF1817E Half-sum 另解与 Trygub Number
一题水两篇怎么说。 上一篇中我们采用智慧方法减少了比较次数,避免了使用复杂的高精度数。现在我们有高论!可以做到 $\mathrm O(\log_B V\log_2 n)$ 在某一位加或者减一个大小 $\mathrm O(V)$ 的数,支持判断正负和取特定位的值。怎么做呢。很简单,我们每一位的数值域原 ......
CF1817E Half-sum
## 题意 有一个大小为 $N$ 的非负整数集合 $A$,每次你可以从集合中取任意两个数,并将它们的平均数放回序列。不停操作,知道集合最后剩下两个数。请求出这两个数的差的绝对值的最大值对 $10^9+7$ 取模的结果。 数据范围:$1\le N\le 10^6, 0\le A_i\le 10^9$。 ......
Leetcode Hot 100 & 560. Subarray Sum Equals K
参考资料: 考点:子串 & [题干] 1 Input: nums = [1,1,1], k = 2 2 Output: 2 这道题说实话看得我一脸懵,第一时间想到的自然是双层循环遍历的一个$O(n^2)$的解法,也就是官方的解法一。但是使用这种解法会超时(Python语言是这样的,评论区有人提到了) ......
AtCoder Beginner Contest 298 Ex Sum of Min of Length
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc298_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc298/tasks/abc298_h "AtCoder 传送门") 挺无脑的。是不是因 ......
[ABC162E] Sum of gcd of Tuples (Hard)
## 题面翻译 给定$n,k$,求 $$\sum^k_{a_1=1}\sum^k_{a_2=1}\sum^k_{a_3=1}\dots\sum^k_{a_n=1}gcd(a_1,a_2,a_3,\dots,a_n)\ mod\ 1000000007$$ ### 制約 - $ 2\ \leq\ N\ ......
2341.maximum Number of Pairs in Array
问题描述 2341. 数组能形成多少数对 (Easy) 给你一个下标从 0 开始的整数数组 nums 。在一步操作中,你可以执行以下步骤: 从 nums 选出 两个 相等的 整数 从 nums 中移除这两个整数,形成一个 数对 请你在 nums 上多次执行此操作直到无法继续执行。 返回一个下标从 0 ......
从 sum 求和谈 axis=1 or 0
## 二维数组 `axis=0`:表示从上往下 `axis=1`:表示从左往右  ```python temp = ......
【每日一题】Problem 1832B - Maximum Sum
[原题](https://codeforces.com/problemset/problem/1832/B) #### 解决思路: 类似滑动窗口的方式,窗口大小为 k 次操作,从中找到更大的结果即可 #### 误区: 一开始的想法是每次都在前一次的基础上减去最少的,然而在样例的第五个测试点出错,因为 ......
【leetcode】104. Maximum Depth of Binary Tree
给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 **说明:** 叶子节点是指没有子节点的节点。 **示例:** 给定二叉树 `[3,9,20,null,null,15,7]`, ``` 3 / \ 9 20 / \ 15 7 ``` 返回它的最大深度 3 ......
Sum of MSLCM 题解
[Sum of MSLCM](https://www.luogu.com.cn/problem/UVA1730) ### 题目大意 定义 $\text{MSLCM}(n)$ 为所有满足该数集的 $\text{lcm}$ 为 $n$ 的数集中元素个数最多的数集的所有数字的和,现有多次询问,求 $$\s ......
[LeetCode] 2101. Detonate the Maximum Bombs
You are given a list of bombs. The range of a bomb is defined as the area where its effect can be felt. This area is in the shape of a circle with the ......
Maximum Strictly Increasing Cells in a Matrix
Maximum Strictly Increasing Cells in a Matrix Given a 1-indexed m x n integer matrix mat, you can select any cell in the matrix as your starting cell. ......
【python】Python报错:RecursionError: maximum recursion depth exceeded in comparison
问题描述 今天测试程序的时候报错了 RecursionError: maximum recursion depth exceeded 通过查阅资料发现原因是查询过相关文档和资料后才发现了问题原因,python的递归深度是有限制的,默认为1000。当递归深度超过1000时,就会报错。 解决方案 可以将 ......
Maximum call stack exceeded(超出最大调用堆栈)错误是什么意思?
你有没有遇到过类似的错误?发生此错误是因为调用堆栈已超出其限制。但是,这是什么意思? 首先,让我们了解什么是调用堆栈。 (https://www.java567.com,搜"javascript") 调用堆栈 调用堆栈是 JavaScript 中的一种数据结构,其中包含正在执行的函数。此结构采用后进 ......
AtCoder Regular Contest 153 D Sum of Sum of Digits
[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc153_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc153/tasks/arc153_d "AtCoder 传送门") 又浪费一道好题 [AtCoder 传送门](https://atcoder.jp/contests/abc267/tasks/abc267_h "AtCoder 传送门") 直接暴力跑背包的复 ......
maximum clique 1 (牛客多校) (转化为图论, 二分图的最大独立集)
题面大意: 给出N个数, 找出最大的子集size 使得 子集中, 任意2个数的 二进制下, 每一位, 至少有2位不同 思路: N 只有5000, 可以直接暴力建边, 转化位图论 2种建边方式: 一种是 能在一个集合的2个数, 建一条边, (没有办法去处理这个问题) 一种是 不能在一个集合的就建一条边 ......
Query execution was interrupted, maximum statement execution time exceeded
数据库版本:MySQL 5.7.16 报错信息: ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded 检查bug库,发现同样问题: https://bugs.my ......
CF1442D Sum
## 题意 有 $n$ 个不降的非负整数数组,每个数组可以不取或取一个前缀,总共要取 $k$ 个元素,问取到的和最大多少。 ## 题解 结论题,但是想到结论还不会。 首先,我们只会有一个数组没选完,其它要么全选要么不选。证明考虑假设两个数组都没选完,基于数组单调不降进行一些分类讨论会发现存在一些严格 ......
AtCoder Regular Contest 130 C Digit Sum Minimization
[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc130_c "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc130/tasks/arc130_c "AtCoder 传送门") 分类讨论,但是写起 ......
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.
问题描述 新建表或者修改表varchar字段长度的时候,出现这个错误 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes stora ......
「USACO2016JAN」Subsequences Summing to Sevens
[USACO16JAN]Subsequences Summing to Sevens S 题目描述 Farmer John's $N$ cows are standing in a row, as they have a tendency to do from time to time. Each ......
微信小程序 自定义组件 监听数据变化 出现异常 Maximum call stack size exceeded.
代码 调用处: 组件内部 本地调试无异常,发布之后出现此异常 解决方法: 监听属性steps的值变化时,调用处不能使用双向绑定,去掉steps的双向绑定即可,具体的原因未知(不知为啥本地调试不会抛异常) ......
POJ2739 Sum of Consecutive Prime Numbers&&Acwing4938 连续质数之和
方法:单调队列 为什么是单调队列?因为这里让我们求连续的质数和,我们可以利用欧拉筛来维护质数,再利用单调队列来维护连续的质数。 代码( ~~POJ 不支持 C++ 11 差评~~): #include<cstdlib> #include<cstring> #include<cstdio> #incl ......
Codeforces 1817E - Half-sum
好题啊!最喜欢这种思路层层递进的题了。 首先从最终形态的角度入手分析。建立一棵合并树,每次合并两个数的时候就新建一个节点,令这个节点为合并的两个节点的父亲。那么显然一个点对答案的贡献系数就是 $2^{-\text{其在合并树中的深度}}$。更具体地不妨设 $B>A$,最终被划分在 $A$ 对应的数中 ......
PAT Advanced 1007. Maximum Subsequence Sum
PAT Advanced 1007. Maximum Subsequence Sum 1. Problem Description: Given a sequence of $K$ integers { $N_1, N_2, ..., N_K$ }. A continuous subsequence ......
[LeetCode] 1456. Maximum Number of Vowels in a Substring of Given Length
Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k. Vowel letters in English are 'a', ' ......
Prometheus之sum_over_time函数
一、sum_over_time sum_over_time 是 Prometheus 中用于计算指定时间段内时间序列数据的和的函数。它可以对单个时间序列或多个时间序列进行操作,并返回指定时间范围内时间序列值的总和。 sum_over_time 函数的语法如下: sum_over_time(range ......