counting atcoder another 259h

AtCoder Beginner Contest 201 E - Xor Distances

# E - Xor Distances [原题链接](https://atcoder.jp/contests/abc201/tasks/abc201_e) 题意:设dist(i,j)即i到j之间路径的异或和,求树上所有两点之间dist(i,j)的和 思路:dist(i,j) = dist(i,1)^ ......
Distances Beginner AtCoder Contest 201

AtCoder Beginner Contest 201 D - Game in Momotetsu World

# D - Game in Momotetsu World [原题链接](https://atcoder.jp/contests/abc201/tasks/abc201_d) 题意 有一个 H×W 的方格,每个方格里写着 '+' 或 '-' 有一个初始在 (1,1),(也就是左上角)的棋子, Tak ......
Momotetsu Beginner AtCoder Contest World

AtCoder Beginner Contest 317 D - President

# D - President [原题链接](https://atcoder.jp/contests/abc317/tasks/abc317_d) 题意:一共n轮,每一轮Xi > Yi (票数)时,X可以获得Zi 张席位,反之亦然;最终席位总和多的就获胜;因此要使X获胜,求Y至少要给X多少个票 思路 ......
President Beginner AtCoder Contest 317

AtCoder Beginner Contest 317 C - Remembering the Days

# C - Remembering the Days [原题链接](https://atcoder.jp/contests/abc317/tasks/abc317_c) 题意:每个点最多经过一次,求最长路 思路:数据范围很小,深搜每个点能到其他点的所有路,取最大 ```c++ #include us ......
Remembering Beginner AtCoder Contest Days

AtCoder Beginner Contest 317

# A - Potions ```cpp #include using namespace std; #define int long long int power(int x, int y, int p) { x %= p; int ans = 1; while (y) { if (y & 1) ......
Beginner AtCoder Contest 317

AtCoder Beginner Contest 296 C - Gap Existence

# C - Gap Existence [原题链接](https://atcoder.jp/contests/abc296/tasks/abc296_c) 题意:是否存在Ai - Aj = x 思路:排序,双指针 ```c++ #include using namespace std; const ......
Existence Beginner AtCoder Contest 296

AtCoder Beginner Contest 292 E - Transitivity

# E - Transitivity [原题链接](https://atcoder.jp/contests/abc292/tasks/abc292_e) 题意:对于一个有向图,进行加边操作,使最终任意的个点具有传递效果,即若a到b有边,b到c有边,那么a到c也要有边,问最少需要进行多少次操作,使得每 ......
Transitivity Beginner AtCoder Contest 292

AtCoder Beginner Contest 292 D - Unicyclic Components

# D - Unicyclic Components [原题链接](https://atcoder.jp/contests/abc292/tasks/abc292_d) 题意:判断一个连通块的边和点个数是否相同 思路:对它使用并查集吧 点击查看代码 ``` #include using namesp ......

[LeetCode][338]counting-bits

# Content Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary repres ......
counting-bits LeetCode counting bits 338

[CF1518D] XOR Counting

[XOR Counting](https://www.luogu.com.cn/problem/CF1815D) 由于 a 可以为非负整数并且不关心 a 的具体数值,所以 m 大了后填很多 0 即可。 分类讨论。 m=1 时直接输出 n 即可。 m>=3 时,注意到 xor 运算与加运算同奇偶,所以 ......
Counting 1518D 1518 XOR CF

AtCoder Regular Contest 164

# Preface 补一下好久之前的ARC,ABC的话如果没事会考虑从后往前补一下 # **A - Ternary Decomposition** 首先判掉当$k>n$时一定无解,否则可以贪心地对$n$进行三进制分解,得到最少可以拆成$k'$个数 不难发现我们总可以把其中较大的数拆成三个小的,以此来 ......
AtCoder Regular Contest 164

Atcoder Beginner Contest 317 解题报告

# Atcoder Beginner Contest 317 ABC316 咋没了。 暂时 A~E。 ## Hints D $\quad$可以算出每次选举需要的改票数。然后变成了一个经典问题。 E $\quad$有点 naive。不用担心暴力扫 T 掉,时间复杂度是真的。 F $\quad$F1 $ ......
Beginner Atcoder Contest 报告 317

mysql 深入学习三 索引优化三 (分页、关联、count()、字段选择 的优化)

-- 示例表: CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_a` ......
字段 索引 mysql count

AtCoder Beginner Contest 317 F - Nim

## 数位 DP ```cpp #include using namespace std; using ll = long long; int dp[64][10][10][10][2][2][2][2][2][2]; int main() { ll n; int b1, b2, b3; cin > ......
Beginner AtCoder Contest 317 Nim

【1342C】Yet Another Counting Problem(数论)

**题目大意:** 求有多少$x(1\le l\le x\le r\le 10^{18})$满足$(x\mod a)\mod b\neq(x\mod b)\mod a(1\le a,b\le 200)$,有$q(1\le q\le 500)$次询问。 *** 设答案为$f(l,r)$,考虑前缀和$f ......
数论 Counting Another Problem 1342C

SP13015 CNTPRIME -Counting Primes

##[$CNTPRIME$ - $Counting$ $Primes$](https://www.spoj.com/problems/CNTPRIME/) ### 题目描述 给定初始序列 $A$,然后对原序列有以下操作: - 操作 $1$:`0 l r v` 将区间$[l,r]$ 全赋值为$v$。 ......
CNTPRIME Counting Primes 13015 SP

AtCoder Beginner Contest 317 G Rearranging

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc317_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc317/tasks/abc317_g "AtCoder 传送门") 考虑转化成匹配问题 ......
Rearranging Beginner AtCoder Contest 317

Atcoder Beginner Contest 317(F~G)

**两发罚时:** 1. D long long。 2. E bfs 不在把元素扔进队列前标记。 ## F. [Nim](https://atcoder.jp/contests/abc317/tasks/abc317_f) 考虑 $a_i$ 很小,$n$ 很大,于是不妨数位 dp。 设 $dp_{i ......
Beginner Atcoder Contest 317

AtCoder Beginner Contest 215

[ABC215F] Dist Max 2 二分出 min( | xi - xj | , | yi - yj | ),双指针维护是否存在满足条件的点对(i, j),假如二分当前值是x,那么 |xi - xj| >= x &&|yi - yj| >= x #include<bits/stdc++.h> ......
Beginner AtCoder Contest 215

CF1815D XOR Counting 题解

## 题意 给定 $n, m$,对于所有满足 $\displaystyle \left(\sum\limits_{i = 1}^{m}a_i\right) = n$ 的非负整数序列 $a_m$,求所有可能的 $\displaystyle \bigoplus\limits_{i = 1}^{m} a_ ......
题解 Counting 1815D 1815 XOR

题解 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

AtCoder Beginner Contest 314

# A - 3.14 ```cpp #include using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0), cin.tie(0); string s = "14159265358979 ......
Beginner AtCoder Contest 314

[LeetCode] 1267. Count Servers that Communicate

You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that ......
Communicate LeetCode Servers Count 1267

AtCoder Beginner Contest 315

# A - tcdr ```cpp #include using namespace std; int32_t main() { string s; cin >> s; for( auto i : s){ if( i != 'a' and i != 'e' and i != 'i' and i != ......
Beginner AtCoder Contest 315

CF1749D Counting Arrays

> 给定一个数组 $a$,同时给定一个操作:选取一个数字 $i$,如果 $\gcd(a_i,i) = 1$,我们就可以将**当前**的第 $i$ 位上的数字 $a_i$ 移除掉,而后面的数字会以此补上空缺。 > > 定义一个序列 $b$ 为一个“移除序列”,当且仅当我们可以通过依次选取 $b_1$ ......
Counting Arrays 1749D 1749 CF

AtCoder Beginner Contest 287 - C (图论简单题)

[toc] # [C - Path Graph?](https://atcoder.jp/contests/abc287/tasks/abc287_c) **题意** 判断给定的无向简单图是不是一条链 **思路** n 个顶点 m 条边的无向图若为一条链,那么边数 $m = n - 1$,n 个顶点 ......
Beginner AtCoder Contest 287

AtCoder Beginner Contest 315

第一次打abc正赛 ## D. Magical Cookies [D - Magical Cookies (atcoder.jp)](https://atcoder.jp/contests/abc315/tasks/abc315_d) ### 题意 给定一个矩阵,矩阵每个点放着一种饼干,饼干种类用小 ......
Beginner AtCoder Contest 315

QOJ # 6509. Not Another Range Query Problem

[题面传送门](https://qoj.ac/problem/6509) 首先~~~感性理解~~理性分析一下会发现,如果不考虑额外删除的第一个,对全局模拟一次删除,求出每个点的删除时间和是前面哪个点给他删除的,那么在进行区间询问的时候,如果一个点被删除了并且不是被第一个点删除的,那么这个点的删除点和 ......
Another Problem Range Query 6509

AtCoder Beginner Contest 315

# [AtCoder Beginner Contest 315](https://atcoder.jp/contests/abc315) ## [A - tcdr (atcoder.jp)](https://atcoder.jp/contests/abc315/tasks/abc315_a) **一 ......
Beginner AtCoder Contest 315

AtCoder Beginner Contest 315 - E (toposort)

[toc] # [E - Prerequisites](https://atcoder.jp/contests/abc315/tasks/abc315_e) **题意** n 本书,序号 1 ~ n。给定阅读每本书之前必须要看的书的序号。 请你输出任意一种看第一本书所需看书数量最少的方法 **思路* ......
Beginner toposort AtCoder Contest 315