counting 212h abc nim

学习爬虫入门2,count反爬虫思路

浏览网页的过程 1.输入网址 2.浏览器向DNS服务商发起请求 3.找到对应服务器 4.服务器解析请求 5.服务器处理最终请求发回去 6.浏览器解析返回数据 7.展示给用户 爬虫策略 广度优先 深度优先 聚焦爬虫 BFS 从根节点开始 沿着树的宽度 深度优先 DFS 尽可能深的搜索树的分支 然后再返 ......
爬虫 思路 count

[ABC114D] 756 题解

[题目链接](https://atcoder.jp/contests/abc114/tasks/abc114_d) ## 题意 给定一个数 $n$,求 $n!$ 的因数中,刚好有 $75$ 个因数的数的个数。 ## 分析 首先有这样一个性质,对于一个数 $a$,我们将其分解质因数,即 $$a = \ ......
题解 114D ABC 114 756

[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\ ......
Tuples 162E Hard of ABC

题解 ABC207F【Tree Patrolling】

挺简单的树上背包,就是有点难写。 设 ${dp}_{u,i,x,y}$ 表示仅考虑 $u$ 的子树内,有 $i$ 个节点被控制,$x$ 为节点 $u$ 是否有警卫,$y$ 为节点 $u$ 是否被控制。(其实所有 $x=1,y=0$ 的状态都没用,但我懒得管了。) 每个点 $u$ 的初始值为 ${dp ......
题解 Patrolling 207F Tree ABC

[AGC055A] ABC Identity 题解

# [AGC055A] ABC Identity 题解 ## 题目描述 给定长度为 $3n (1 \le n \le 2e5)$ 的序列,其中字母 A,B,C 各有 $n$ 个。 一个合法序列 $T$ 满足以下条件: - 其长度为 $3k (1 \le k \le n)$。 - $T_1 = T_2 ......
题解 Identity 055A AGC 055

[LeetCode] 1348. Tweet Counts Per Frequency 推文计数

A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These perio ......
Frequency LeetCode Counts Tweet 1348

[ABC305E] Art Gallery on Graph

[Art Gallery on Graph の 传送门](https://www.luogu.com.cn/problem/AT_abc305_e) ## Problem 有一个由 $N$ 个点 $M$ 边的简单无向图,顶点编号为 $1$ 到 $N$,边的编号为 $1$ 到 $M$。 第 $ i $ ......
Gallery Graph 305E ABC 305

[ABC305D] Sleep Log题解

# 题目大意 给 $N$ 个时刻: - 当 $i$ 为奇数时,$A_i$ 表示刚刚起床的时刻。 - 当 $i$ 为偶数时,$A_i$ 表示开始睡觉的时刻。 有 $Q$ 次询问,每次求在 $[l,r]$ 区间内睡了多长时间。 # 分析 首先我们要考虑处理边界情况。 每一次二分查找第一个大于等于 $l$ ......
题解 Sleep 305D ABC 305

[ABC305C] Snuke the Cookie Picker题解

# 题目大意 有一个 $H\times W$ 的网格,一种有一个矩形,矩形中间有一个点被挖空,求这个点的坐标。(. 表示空白,# 表示矩形内的点) # 解析 观察我们可以发现,每一矩形内的个点上下左右至少会有两个是 #。 如图: ![](https://cdn.luogu.com.cn/upload ......
题解 Cookie Picker Snuke 305C

已解决 DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop workingfrom collections import Iterable

场景描述 E:/worksp_py/hardwary/100day/twentyfive/itertor.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collect ......

[ABC212E] Safety Journey 题解

[Safety Journey](https://www.luogu.com.cn/problem/AT_abc212_e) ### 题目大意 给定一张缺少了 $m$ 条边的 $n$ 个点的完全图和一个正整数 $k$,你需要求出满足以下条件的序列 $A$ 的数量: - $A$ 的长度为 $k+1$。 ......
题解 Journey Safety 212E ABC

[ABC303G] Bags Game 解题分析

### 1 题目大意 **1.1 题目翻译** 有两个人轮流取物品。总共有 $n$ 个物品,第 $i$ 个物品的价值为 $w_i$。 他们按照下面的其中一种方式取物品: * 取出这一排物品最前面的或者最后面的。这一步没有代价。 * 设还剩下 $m$ 个物品,那么重复取出 $\min(B, m)$ 个 ......
303G Bags Game ABC 303

ABC305

## T1:[Water Station](https://atcoder.jp/contests/abc305/tasks/abc305_a "Water Station") 模拟 代码实现 ``` // C++实现 #include using namespace std; int main() ......
ABC 305

MySQL优化案例:count(*) 如何优化?

想要优化count(*),首先得了解清楚,MySQL是如何处理count(*)的?在MySQL不同版本、不同存储引擎中,对于count(*)的处理方式,是存在差异的。MyISAM使用过MyISAM存储引擎的DBA,应该都有这感觉:不管表有多大,count(*)总是能够秒出结果。这是因为,MyISAM ......
案例 MySQL count

nim 内联汇编加载 shellcode(nim学习系列)

# nim 内联汇编加载 shellcode ## GCC 汇编语法 Linux上的 GNU C 编译器 GCC ,使用 AT&T / UNIX 汇编语法,AT&T 语法和 Intel 语法的差别很大。现在我们看到了 Intel 语法和 AT&T 语法之间的一些主要差别。我仅仅写了它们差别的一部分而 ......
nim shellcode

Shellcode Execution in a Local Process with QueueUserAPC and NtTestAlert(nim学习系列)

# Shellcode Execution in a Local Process with QueueUserAPC and NtTestAlert ## APC队列 异步过程调用(APC)队列是一个与线程关联的队列,用于存储要在该线程上下文中异步执行的函数。操作系统内核会跟踪每个线程的 APC 队 ......

ATCoder [ABC167D] Teleporter

# 题目解析 这段代码的目标是处理一个含有 $n$ 个元素的整数序列,根据一定的规则,重复操作 $k$ 次后,确定操作结束时位于序列哪个位置。 ## 解题思路 1. **读取输入**:首先,我们读取输入的整数 $n$ 和 $k$ ,以及整数序列 `a`。我们需要对序列的每个元素减一,以适应从 0 开 ......
Teleporter ATCoder 167D ABC 167

Injecting to Remote Process via Thread Hijacking(nim学习系列)

# Injecting to Remote Process via Thread Hijacking ## metasploit 监听 metasplit ``` msfconsole -x "use exploits/multi/handler; set lhost 192.168.0.101; ......
Injecting Hijacking Process Remote Thread

ABC301

## T1:[Overall Winner](https://atcoder.jp/contests/abc301/tasks/abc301_a) 模拟 代码实现 ``` #include #define rep(i, n) for (int i = 0; i > n >> s; int t = 0 ......
ABC 301

Atcoder ABC221G Jumping sequence

发现这个 $(x, y)$ 对应的是曼哈顿距离不太好求,那直接逆时针旋转 $45$ 度(其实应该还要伸长 $\sqrt{2}$ 倍,但是可以当做 $d_i$ 也伸长 $\sqrt{2}$ 倍不用去管)转化成切比雪夫距离 $(x - y, x + y)$。 同时对应的 $4$ 个方向在旋转后对应的方向 ......
sequence Atcoder Jumping 221G ABC

[ABC166F] Three Variables Game

[Three Variables Game の 传送门](https://www.luogu.com.cn/problem/AT_abc166_f) ## Solution 首先,我们每次操作只会修改两个数。 所以考虑 dfs 枚举操作的顺序,但是这让时间复杂度变为 $O(2^n)$,不能接受。 但 ......
Variables Three 166F Game ABC

[AGC055B] ABC Supremacy 题解

# [AGC055B] ABC Supremacy 题解 ## 题目描述 给定两个长度为 $n$ 的字符串 $a$,$b$。 你可以进行若干次以下操作: - 若 $a$ 中的一个**子串**为 `ABC`,`BCA` 或 `CAB`,那么可以将这个子串替换为 `ABC`,`BCA` 或 `CAB`。 ......
题解 Supremacy 055B AGC 055

[ABC166E] This Message Will Self-Destruct in 5s

[This Message Will Self-Destruct in 5s の 传送门](https://www.luogu.com.cn/problem/AT_abc166_e) ## Solution 首先看到 > $j-i=A_i+A_j$ 转换一下,$i+a_i=j-a_j$。 接下来,对 ......
Self-Destruct Destruct Message 166E This

Atcoder ABC221F Diameter set

不难。 第一步肯定是求出直径 $d$。 然后能发现 $d\bmod 2 = 0$ 时很好求。 可以先任意找到一条直径,再找到这个直径的中点,则容易知道以这个中点为根,其中的每个子树的节点与中点经过的边数最大值为 $\frac{d}{2}$。 所以能够得到每个子树内选两个点距离最大值也为 $d - 2 ......
Diameter Atcoder 221F ABC 221

[LeetCode] 1351. Count Negative Numbers in a Sorted Matrix

Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Exampl ......
LeetCode Negative Numbers Matrix Sorted

ABC277G 题解

## 前言 [题目传送门!](https://www.luogu.com.cn/problem/AT_abc277_g) [更好的阅读体验?](https://www.cnblogs.com/liangbowen/p/17464231.html) 好题,记录一手拆贡献的 trick。 ## 思路 我 ......
题解 277G ABC 277

使用gorm进行数量统计【limit、offset对count的统计的影响】

limit、offset对count的统计的影响 错误示例1:请注意,如下例子中,Count放在了最后面,查询时,count方法也会加上Limit和offset这两个语句: global.DB.Limit(10).Offset(2).Find(&users).Count(&total) 错误示例2: ......
数量 offset count limit gorm

ABC300F 题解

前两天忘发出来了,补一下QAQ ## [题目链接](https://www.luogu.com.cn/problem/AT_abc300_f) ## 题意简述 给定一个长度为 $n$ 且只包含 $\texttt{o}$ 和 $\texttt{x}$ 的字符串 $s$ 以及正整数 $n$ $m$ $k ......
题解 300F ABC 300

Luogu P3605 [USACO17JAN]Promotion Counting P

# [USACO17JAN]Promotion Counting P ## 题目描述 The cows have once again tried to form a startup company, failing to remember from past experience that cow ......
Promotion Counting Luogu P3605 USACO

ABC237G Range Sort Query

## 思路 这道题跟 P2824 的思路是很相似的。 首先由于我们只需求一个特定的值在排序后的位置,而原序列又是一个排列,因此我们可以将序列中的所有数分为三种: 1. 大于 $X$ 的; 2. 等于 $X$ 的; 3. 小于 $X$ 的。 我们不关心除了 $X$ 之外的其他值的具体数字,而只关心其与 ......
Range Query 237G Sort ABC