odds
[LeetCode] 2415. Reverse Odd Levels of Binary Tree
Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose the node values at level 3 are [2 ......
[Codeforces] CF1722G Even-Odd XOR
CF1722G Even-Odd XOR 题意 给定一个正整数 \(n\),请你找出一个长度为 \(n\) 数组 \(a\),满足数组是由互不相同的非负且小于 \(2^{31}\) 的整数组成,并且该数组中奇数项上元素的异或值与偶数项上元素的异或值要相等。 思路 根据异或的交换律,可以发现:奇偶位异 ......
[LeetCode] 1903. Largest Odd Number in String
You are given a string num, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or ......
[UVA12683] Odd and Even Zeroes
Description 给出 \(n\),求出 \(0!, 1!, 2! \ldots, n!\) 中有几个末尾有偶数个 \(0\)。 \(1\le n\le 10^{18}\)。 Solution 根据基本结论,一个数末尾 \(0\) 的个数等于该数有几个因数 \(5\)。而一个数的阶乘末尾有几个 ......
Codeforces Round 697 (Div. 3) A. Odd Divisor
给定一个正整数 \(n\) ,询问是否存在一个 \(> 1\) 的奇数因子。 在唯一分解定理下观察 \(n\) ,发现若存在除 \(2\) 以外的质因子,则 \(n\) 存在 \(> 1\) 的奇数因子。 换句话说 \(n\) 不是二次幂形式则存在 \(> 1\) 的奇数因子。 view #incl ......
Codeforces Round 697 (Div. 3) A. Odd Divisor
给一个正整数 \(n\) ,判断 \(n\) 是否存在一个 \(> 1\) 的奇数因子。 只要 \(n\) 的唯一分解下存在除 \(2\) 以外的质因子,则 \(n\) 存在 \(>1\) 的奇数因子。 于是 \(n \neq lowbit(n)\) 则 \(n\) 存在奇数因子。(应用了 \(2^ ......
Codeforces Round 753 (Div. 3) B. Odd Grasshopper
一维坐标轴上,蚱蜢一开始在 \(x_0\) 。在第 \(1\) 秒往后的每秒,第 \(i\) 秒蚱蜢可以跳 \(i\) 步。即若当时在 \(x\) ,可以跳到 \(x + i\) 或 \(x - i\) 。额外的,若 \(x\) 为偶数,蚱蜢会往左跳;否则会往右跳。 询问 \(n\) 秒后蚱蜢的坐标 ......
Codeforces Round 859 (Div. 4) D. Odd Queries
给一个长为 $n$ 的数组 $a$ 。回到 $q$ 个询问。 * 让 $a_l, a_{l + 1}, \cdots, a_r$ 变为 $k$ ,$\sum_{i = 1}^r a_i$ 是否为奇数。 每个询问独立。 显然每个学问独立可以使用前缀和计算区间和,单个询问中 $pre_{1, l - 1 ......
[ABC134F] Permutation Oddness 题解
## 题面 定义一个 $1 \sim n$ 的排列 $p$ 的「怪异度」为 $$\sum_{i=1}^n\left\lvert p_i-i\right\rvert$$ 求「怪异度」为 $k$ 的 $1 \sim n$ 的排列数,答案对 $10^9+7$ 取模。 ## 题解 考虑转化计算怪异度的过程, ......
[ABC134F] Permutation Oddness
### 题目大意 定义一个 $1 \sim n$ 的排列 $p$ 的「怪异度」为 $$\sum_{i=1}^n|p_i-i|$$ 求「怪异度」为 $m$ 的 $1 \sim n$ 的排列数,答案对 $10^9+7$ 取模。 ### 思路 考虑把 $p_i$ 和 $i$ 看作小球与盒子,方便题意理解。 ......
基因型比值比(genotypic odds ratio)和等位基因比值比(allelic odds ratio)的计算
基因型比值比(genotypic odds ratio)和等位基因比值比(allelic odds ratio)是两个不同的概念。一般而言,通过PLINK、GCTA等工具计算得到的比值比指的是等位基因比值比。 以下是基因型比值比和等位基因比值比的各自计算公式。假设有`a/a`,`A/a`,`A/A` ......
[AT_abc313_d] Odd or Even
简单题,但是为什么赛场上 WA 了呢? 弱化题目,设 $n = k + 1$,发现只需要每一个数不取询问 $k$ 次,通过前缀和得出。 再设 $k + 1 \ | \ n$,发现只需要类似分块即可解决。 回到原题,最后的一部分如何计算?我们可以对 $[n - k, n]$ 这个区间做询问,但是对于已 ......
Atcoder ARC161C Dyed by Majority (Odd Tree)
首先能发现对于树的叶子节点,与其连边的只有其父节点,所以该节点最终状态为 $\text{B/W}$ 其父节点的状态就一定为 $\text{B/W}$。 然后考虑它自己是什么状态,因为同样的与其连边的只有其父节点,所以其父节点最终状态为 $\text{B/W}$ 其状态就为 $\text{B/W}$。 ......
odd-one-out
# odd-one-out 谷歌找出AI生成的图片 小游戏 ![image-20230630101619255](https://img2023.cnblogs.com/blog/540671/202306/540671-20230630101715677-1428537190.png) ![odd ......
D Odd Queries 题解
[原题传送门](https://www.luogu.com.cn/problem/CF1807D) ### 题意简述 给定一个数组,再给出 m 个各自**独立**(即这个操作不影响后续的询问)的询问,每次给定一个区间,询问将这个区间每个元素都修改为k后,数组总和会是奇数吗? ### 解决思路 由于n ......
AtCoder Beginner Contest 258 Ex Odd Steps
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc258_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc258/tasks/abc258_h "AtCoder 传送门") 不错的矩阵快速幂优 ......
[LeetCode] 2451. Odd String Difference
You are given an array of equal-length strings words. Assume that the length of each string is n. Each string words[i] can be converted into a differe ......
AtCoder Beginner Contest 267 Ex Odd Sum
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc267_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc267/tasks/abc267_h "AtCoder 传送门") 直接暴力跑背包的复 ......