Sum
ARC125F Tree Degree Subset Sum
感觉挺不错的一道题,不过课上 pb 好像没有讲。 显然树的具体形态对题目影响不大,那么我们知道 $\sum\limits_{i=1}^nd_i=2n-2$ 即可扔掉树的条件。即: > 给定 $n$ 个 $d_i$,和为 $2n-2$,求 $(x,y)$ 满足 $0\le x\le n$ 且 $\ex ......
CF280D k-Maximum Subsequence Sum
大半个月前做的题,现在才写题解,/qd/qd。 贪心,选出 $k$ 个不相交子段的和的最大值,其实相当于每次把序列最大子段拎出来,加上去,然后取相反数。 证明的话可以考虑模拟费用流,$i\le n$,$S\to i$ 连边,$i\to i+1$ 连边,$i\to T$ 连边,边的流量均为 $1$,$ ......
LG4868 Preprefix sum 题解
# 壹、题目大意 给出长度为 $n$ 的序列 $a_1 \sim a_n$,设 $S_i = \sum\limits_{j=1}^i a_j$,有两种操作 可以给定 $i$ 和 $x$,使得 $a_i = x$,也可以给定 $i$,查询 $\sum\limits_{j=1}^i S_j$ 的值 $n ......
ARC163D Sum of SCC
### Description 给定 $N,M$,求对于所有 $N$ 个点的,满足恰有 $M$ 条从小连向大的边,即 $\sum\limits_{(u,v)\in E}[u 给竞赛图每个 SCC (强连通分量)缩点后,剩下的是由一条**极长**的链与某些前向边组成的图。 于是 SCC 的数量能够转换 ......
sha256sum
sha256sum 用于计算文件的 SHA-256 哈希值 ## 补充说明 **sha256sum命令** 是打印或检查 SHA256(256位)校验 ### 语法 ```shell sha256sum [OPTION]... [FILE]... ``` ### 选项 ```shell -b, -- ......
sum
sum 计算文件的校验码和显示块数 ## 补充说明 **sum命令** 用于计算并显示指定文件的校验和与文件所占用的磁盘块数。 ### 语法 ```shell sum(选项)(参数) ``` ### 选项 ```shell -r:使用BSD的校验和算法,块大小为1k; -s:使用system V的校 ......
Atcoder Grand Contest 057 D - Sum Avoidance
先来找些性质: - $A$ 中最小的元素 $M$ 肯定是最小的不是 $S$ 的因子的数,由于 $\text{lcm}(1,2,3,\cdots,43)>10^{18}$,所以 $M\le 43$。 - 对于每个 $0\le iS)break; for(int j=1;j>1; if(calc(mid ......
常用的统计数学函数:sum, sd, mean, cv
```c++ /*********************************************************************** * @file math.h * @ingroup math * @author wangqing * @date 2020-05-14 * ......
[LeetCode] 2461. Maximum Sum of Distinct Subarrays With Length K
You are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions: T ......
834. Sum of Distances in Tree (Hard)
Description 834. Sum of Distances in Tree (Hard) There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are g ......
UVA10791 最小公倍数的最小和 Minimum Sum LCM 题解
### 前言 长沙市一中8机房0714模拟测1。 [传送门](https://www.luogu.com.cn/problem/UVA10791) [blog](https://www.luogu.com.cn/blog/JJL0610666/solution-uva10791) # 思路 本题思路 ......
linux 中 md5sum -c选项
001、 [root@PC1 test01]# ls [root@PC1 test01]# seq 5 > a.txt; seq 3 > b.txt ## 生成测试数据 [root@PC1 test01]# ls a.txt b.txt [root@PC1 test01]# md5sum b.txt ......
Atcoder AGC062C Mex of Subset Sum
对 $a_i$ 从小到大进行排序,因为想到若 $ a_{i - 1}$ 肯定是能保证取不到的。 对排完序的 $a_i$ 做一个前缀和 $s_i = \sum\limits_{j = 1}^n$,令 $A_i$ 为 $a_{1\sim i}$ 中无法表示为子序列之和且 $ s_{i - 1} > x$ ......
PAT-甲级-1007 Maximum Subsequence Sum C++
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1≤i≤j≤K. The Maximum S ......
[LeetCode] 931. Minimum Falling Path Sum
Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path starts at any element in the first ......
AT_agc062_c [AGC062C] Mex of Subset Sum 思维妙妙题--zhengjun
思路比较巧妙。 首先排序。 考虑目前维护出 $a_{1 \sim i}$ 不能表示的数的集合 $S$。 考虑如何加入 $a_{i+1}$。 如果当前 $sum$ $$S'=S\cup [sum+1,a_{i+1}-1] \cup \{x+a_{i+1}|x\in S\}$$ - 若 $|S\cup ......
Sum in Binary Tree
Sum in Binary Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya really likes mat ......
Maximum Sum
Maximum Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array a1,a2 ......
CF1817E Half-sum
`greedy` 把数分成两个集合 $A,B$,且 $A 定理 $1$ > > $A$ 集合合并的顺序一定是从大往小的,$B$ 集合是从小往大的。 应该很好猜到,但是证明需要一点推导。 大概可以局部到 $x,y,z,w$ 四个数的情况。 几种情况分别是 $\frac{x+y}{8}+\frac{z} ......
ARC107F Sum of Abs
# ARC107F Sum of Abs **[题目传送门——洛谷](https://www.luogu.com.cn/problem/AT_arc107_f)** **[题目传送门——AtCoder](https://atcoder.jp/contests/arc107/tasks/arc107_ ......
[LeetCode] 2600. K Items With the Maximum Sum
There is a bag that consists of items, each item has a number 1, 0, or -1 written on it. You are given four non-negative integers numOnes, numZeros, n ......
920 F. SUM and REPLACE
[toc] # F. SUM and REPLACE 题目[传送门](https://codeforces.com/contest/920/problem/F) ## 题意: 给你n个数,按照顺序排列,再进行m次操作。每次操作要么是问你区间[l,r]的和,要么是让你将区间[l,r]的所有数$a_i= ......
[LeetCode] 2679. Sum in a Matrix
You are given a 0-indexed 2D integer array nums. Initially, your score is 0. Perform the following operations until the matrix becomes empty: From eac ......
elasticsearch group sum top 10
``` { "version": true, "size": 0, "sort": [ { "request_length": { "order": "desc", "unmapped_type": "boolean" } } ], "stored_fields": [ "*" ], "script ......
AtCoder Regular Contest 163 D Sum of SCC
[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc163_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc163/tasks/arc163_d "AtCoder 传送门") 怎么连这种相对传统 ......
【每日一题】Problem 489C. Given Length and Sum of Digits...
[原题](https://codeforces.com/problemset/problem/489/C) #### 解决思路 结果值越大,要求满足后续数位能成立的情况下,当前数位的值尽可能大;取最小结果同理 ##### 误区 1. 注意边界 - 一般情况下,数字开头不能为 0,除非数字长度为 ** ......
Codeforces 1458F - Range Diameter Sum
先考虑直径的一些求法:最普遍的想法肯定是从点集中任意一个点开始 DFS 找到距其最远的点,再一遍 DFS 找到距离你找到的那个点最远的点。但是放在这个题肯定是不太行的。因此考虑一种更常用的求法:**合并**。更直观地说:我们定义树上一个圆 $(x,r)$ 表示距离 $x$ 点 $\le r$ 的所有 ......
[LeetCode] 1186. Maximum Subarray Sum with One Deletion
Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y ......
Subset Sum 问题单个物品重量限制前提下的更优算法
## 前言 看了 [ShanLunjiaJian 关于这个问题的文章](https://www.luogu.com.cn/blog/uakioi/nv-knapsack),是完全没看懂,沙东队爷的中枢神经内核配置把我偏序了。叉姐在下面提了个论文,论文找不到资源,谁搞到了可以 Q 我一份之类的拜谢了。 ......