second 140e abc sum

ABC317

## T1:[Potions](https://atcoder.jp/contests/abc317/tasks/abc317_a "Potions") 模拟 代码实现 ``` n, h, x = map(int, input().split()) p = list(map(int, input() ......
ABC 317

[LeetCode][494]target-sum

# Content You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and ......
target-sum LeetCode target 494 sum

[LeetCode][416]partition-equal-subset-sum

# Content Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements in both subsets i ......

ABC 317 A - G

# ABC 317 A - G 代码去 Atcoder 全部提交搜索 Std_Code 查看代码 [懒人专用](https://atcoder.jp/contests/abc317/submissions?f.Task=&f.LanguageName=&f.Status=&f.User=Std_Co ......
ABC 317

abc302f

[abc302f](https://atcoder.jp/contests/abc302/tasks/abc302_f) 不是很难,但是还是有点绕 很明显是一个图的模型 但是边数很大 我们只关心每种数最早什么时候能够得到 对于每一种数,我们记录哪些集合包含它,每得到一个新的数,就用它来更新 ```c ......
302f abc 302

md5sum 文件一致性校验

1. 背景 在网络传输、设备之间转存、复制大文件等时,可能会出现传输前后数据不一致的情况。这种情况在网络这种相对更不稳定的环境中,容易出现。那么校验文件的完整性,也是势在必行的。 md5sum命令用于生成和校验文件的md5值。它会逐位对文件的内容进行校验。是文件的内容,与文件名无关,也就是文件内容相 ......
一致性 文件 md5sum 5sum md5

ABC做题记录

做之前没有想到AT的题还是有一定难度的,加油! ### ABC317 #### E - Avoid Eye Contact 随便bfs一下就好 #### F - Nim 考虑数位dp,用 $dp[x][r1][r2][r3][d1][d2][d3][z1][z2][z3]$ 记录位数,余数,最高位限 ......
ABC

【CF1519D】Maximum Sum of Products

```cpp #include using namespace std; typedef long long ll; ll n,a[5000+10],b[5000+10],abpre[5000+10],absuf[5000+10],ans; int main(){ cin >> n; for(ll ......
Products Maximum 1519D 1519 Sum

abc265e Warp

[Warp](https://atcoder.jp/contests/abc265/tasks/abc265_e) 大概就是个dp f[n][x][y]表示走了n步,第一种走了x次,第二种走了y次。 不过写来写去发现都会TLE,N^3怎么会TLE呢? 后面发现原来是map的写法一直有问题, 比如判断 ......
265e Warp abc 265

torch.sum()用法-截至2023年8月28日

torch.sum()维度0,1,2。比如现在有$3\times\ 2\times3$的张量,理解为3个$2\times3$的矩阵。当dim=0,1,2时分别在哪个维度上相加[^文艺数学君]?下面是具体的矩阵 $$ [1,2,3]\\ [4,5,6]\\\\ [1,2,3] \\ [4,5,6]\\ ......
torch 2023 sum

Leetcode 15. 三数之和(3Sum)

[题目链接](https://leetcode.cn/problems/3sum) 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i != j、i != k 且 j != k ,同时还满足 nums[i] + nums[j] + nu ......
之和 Leetcode 3Sum Sum 15

ABC317F题解

让人头大的数位DP。建议评蓝。个人认为不适合放ABC的F。 将三个数二进制拆分,使三个数异或为0相当于每个二进制位三个数中有0或2个是1。 所以考虑数位DP,设 $dp[i][m1][m2][m3][lim1][lim2][lim3]$ 为第 $i$ 位,三个数模 $a$ , $b$ , $c$ 分 ......
题解 317F ABC 317

AT_agc030_d [AGC030D] Inversion Sum 题解

# AT_agc030_d [AGC030D] Inversion Sum 题解 ## 题目大意 给你一个长度为 $n$ 的数列,然后给你 $q$ 次交换操作,你每次可以选择操作或者不操作,问所有情况下逆序对的总和。($n, q \le 3000$) ## 分析 很容易想到 $dp$,但是发现不好直 ......
题解 030 Inversion AT_agc 030D

[ABC317G] Rearranging 题解

取自我的洛谷博客:https://www.luogu.com.cn/blog/SunnyYuan/solution-at-abc317-g 借鉴了官方题解思路。 ## 思路 首先我们要建立一个二分图。 对于输入的 $a_{i, j}$,我们可以连接 左侧的 $i$ 和 右侧的 $a_{i, j}$。 ......
题解 Rearranging 317G ABC 317

CF979D Kuro and GCD and XOR and SUM

### 题目大意 初始有一个空的集合,和 $Q$ 个操作。对于每个操作,有两种类型,分别用如下的两种形式表示: `1 u`:加入 $u$ 到集合 `2 x k s`:求一个最大的 $v$,使得: 1. $v+x \leq s$ 2. $k \mid \gcd(v,x)$ 3. $x \oplus v ......
and 979D Kuro 979 GCD

001_two_sum

准备工作 安装vscode(并安装其leetcode插件)、nodejs环境。 问题描述 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答 ......
two_sum 001 two sum

Leetcode 454. 四数相加 II(4sum ii)

[题目链接](https://leetcode.cn/problems/4sum-ii) 给你四个整数数组 nums1、nums2、nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足: - 0 nums1[0] + nums2[0] + nums ......
Leetcode 4sum 454 sum II

ABC296D题解

简单题。 考虑 `-1` 的情况,即为 $n^2 #include #define ll unsigned long long ll n,m; ll ans=1llm) ans=min(ans,a*b); } printf("%llu",ans); } return 0; } ``` ......
题解 296D ABC 296

ABC020C题解

本题二分 + 搜索。 我们可以先二分出 $x$ 可能的值,再用搜索检验这个答案是否满足要求。若满足,左端点右移,否则右端点左移。 至于搜索可以用记搜加速。 注意输出要换行,否则会 WA。 ```cpp #include #include int n,m,t; char map[20][20]; in ......
题解 020C ABC 020

CF1442D-Sum

# [Sum](https://codeforces.com/problemset/problem/1442/D) You are given $n$ non-decreasing arrays of non-negative numbers. Vasya repeats the following ......
D-Sum 1442 Sum CF

[AGC030D] Inversion Sum

### 题目大意 一个长度为 $n$ 的数列,然后给你 $q$ 个交换或不交换操作,你可以选择操作或者不操作,问所有情况下逆序对的总和。 答案需要对 $10 ^ 9 + 7$ 取模。 ($n\leq 3000$,$q\leq 3000$)。 ### 思路 这道题非常巧妙。 我们先考虑转化题意,求逆序 ......
Inversion 030D AGC 030 Sum

[AGC030D] Inversion Sum 题解

## 题意 给定一个长度为 $n$ 的排列 $a$ 和 $m$ 个形如 $\left(x,y\right)$ 的操作,每次操作可以选择是否交换 $a_x, a_y$,求最终所有形成的排列的逆序对总数。 ($1 \le n,m \le 3000$)。 ## 题解 考虑转化题意,考虑求出最终总的期望逆序 ......
题解 Inversion 030D AGC 030

[ABC313F] Flip Machines

Problem StatementThere are $N$ cards numbered $1$ through $N$. Each face of a card has an integer written on it; card $i$ has $A_i$ on its front and $ ......
Machines 313F Flip ABC 313

题解 ABC309Ex【Simple Path Counting Problem】

好好玩的题。 设普通生成函数 $F_i$,其中 $[z^k]F_i$ 表示从所有起点走到 $(i,k)$ 的方案数。特别地,$[z^k]F_1=\sum\limits_{a\in A}[a=k]$。 注意到 $F_i=(z^{-1}+1+z)F_{i-1}$ **几乎**成立,但是在 $[z^1]F ......
题解 Counting Problem Simple Path

[LeetCode][124]binary-tree-maximum-path-sum

# Content A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can onl ......

Leetcode 1. 两数之和(Two sum)

[题目链接🔗](https://leetcode.cn/problems/two-sum) 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素 ......
之和 Leetcode Two sum

P1466 Subset Sum

对于从 1∼n 的连续整数集合,能划分成两个子集合,且保证每个集合的数字和是相等的 求可以划分的方案数 ###1. 动态规划 ``` long long maxval(int n){ int sum = (1+n)*n/2; if(sum%2==1) return 0; vector dp(sum+ ......
Subset P1466 1466 Sum

MySQL SUM() 带条件的求和方法与多条件的求和方法

一、单一的求和。 select sum(value) as value from table where user_id = 1 and type = 6 and type_son = 2value 为求和的字段。 as 后面是 sum 求和后给它一个名称。 二、SQL语句中嵌套语句多条件求和。 s ......
条件 方法 MySQL SUM

js 计算对象数组中某个字段sum之和

1、一个字段之和 要计算一个对象数组中某个字段的和,你可以使用 JavaScript 的 Array.prototype.reduce() 方法。reduce() 方法对数组中的每个元素执行一个提供的函数,并将结果累积为单个值。以下是一个示例: 假设你有一个对象数组 data,每个对象都有一个 va ......
之和 数组 字段 对象 sum

[ABC305G]

# [[ABC305G] Banned Substrings](https://www.luogu.com.cn/problem/AT_abc305_g) 考虑到字母只有 `a,b`,且限制串的长度不超过 $6$,可以想到以当前处理到的位数、结尾的字符情况为状态动态规划。可以指记录 $5$ 位。 处 ......
305G ABC 305