多好的上分机会啊,要是换个时间(指改在 NOI 之后)我说不定就能上 2500 了(做白日梦 ing) A 签到题不多说,显然只有末尾为 \(9\) 的数是 interesting 的,因此答案就是 \(\lfloor\dfrac{n+1}{10}\rfloor\) B 暴力枚举两个断点然后线性地检查一遍,时间复杂度 \(n^3\) 不知道为什么这种题会有
\(\text{Problem}\) \(\text{Analysis}\) 显然 \(f=\mu^2\) 那么 \[\begin{aligned} \sum_{i=1}^n \sum_{j=1}^n (i+j)^k &= \sum_{d=1}^n \mu^2(d) d^{k+1} \sum_{i=1}^{\lfloor \frac{n}{d} \rfloor} \sum_{j=1}^{\lfloor \frac{n}{d} \rfloor} (
计算 \(\gcd(i,j)=k\) 的对数 Problem \[\sum_{i=1}^n\sum_{j=1}^m[\gcd(i,j)=k] \]Solution 设 \(f(k)\) 表示 \(\gcd(i,j)==k\) 的对数(即答案),\(g(k)\) 表示 \(k|\gcd(i,j)\) 的对数 根据 \(g\) 的定义,我们知道:\(g(k)=\lfloor\frac nk\rfloor\lfloor\frac mk\rfloor\)
\(\mathcal{Description}\) Link. \(T\) 组询问,每次给出 \(n,a,b,c,k_1,k_2\),求 \[\sum_{x=0}^nx^{k_1}\left\lfloor\frac{ax+b}{c}\right\rfloor^{k_2}\bmod(10^9+7) \] \(T=1000\),\(n,a,b,c\le10^9\),\(0\le k_1+k_2\le 10\)。 \(\mathcal{Soluti
Solution 以前学过,但是太烂,而且很有局限性,今重学一遍。 考虑假设我们要解决的问题为求: \[\sum_{x=0}^{n} x^{k1}\lfloor\frac{ax+b}{c}\rfloor^{k2} \]可以发现可以分为几种情况进行讨论: \(a=0\) 或者 \(\lfloor\frac{an+b}{c}\rfloor=0\) 可以发现 \(\lfloor\frac{ax+b}{c}\rfl
题目 题目链接:https://gmoj.net/senior/#main/show/4496 求 \[\sum^{n}_{i=1}\sum_{j|i}\gcd(j,\frac{i}{j}) \]\(n\leq 10^{11}\)。 思路 \[\sum^{n}_{i=1}\sum_{j|i}\gcd(j,\frac{i}{j}) \]\[=\sum^{n}_{i=1}\sum^{\lfloor\frac{n}{i}\rfloor}_{j=1}\gcd(i,j)
题目链接 记\(g(i) = \operatorname{LCM}(1, 2, \dots, i), h(i) = \lfloor \dfrac{n}{g(i)} \rfloor\)。 易得\(f(k) = i\)的\(k\)的个数为\(h(i) - h(i - 1)\)。 然后叠加相消后可得:\(\sum_{i = 1}^n f(i) = i (h(i) - h(i - 1)) = \sum_{i \ge 1}^{g(i) \le n} \lfloor \dfra
A. Odd Set 看奇数和偶数的数的个数想不想等即可。 B. Plus and Multiply 枚举所有 \(a^k\) 然后判断能不能加若干次 \(b\) 的到 \(n\)。 C. Strange Function 令 \(g(i)=\text{lcm}(1,2,\dots,i)\),不难发现答案为 \(\sum_{}i\times(\lfloor\frac{n}{g(i-1)}\rfloor-\lfloor\frac{
P3708 koishi的数学题(因数和) 题目传送门 值得学习的点 因子和 σ ( n ) =
Description There is a complete graph containing \(n\) vertices, the weight of the \(i\)-th vertex is \(w_i\). The length of edge between vertex \(i\) and \(j\) \((i≠j)\) is \(\lfloor \sqrt{|w_i-w_j|}\rfloor\). Calculate the length of the
Label 经典莫比乌斯反演转化 g c d ( i , j )
Label 灵活变换求和次序的普通莫比乌斯反演 Description 给定 T ( T = 1 0
传送门 第一眼:二分!n这么小是方便跑check的吧 冷静后:我单调性呢 于是考虑暴力 发现n很小,check会比较快 注意到如果i不合法,则i的倍数均不合法,考虑使用埃氏筛优化然而还是TLE30pts 正解是个整除分块: 原式等价于求最大的d满足 \[\sum (\lceil\frac{a_i}{d} \rceil*d-a_i) \leqslant k
传送门: https://www.luogu.com.cn/problem/P3327 https://www.acwing.com/problem/content/1360/ 莫比乌斯反演 + 整除分块 分析 首先,我们给出一个结论: \[d(ij) = \sum_{x|i} \sum_{y|j} [(x, y) = 1] \]证明: 设 \(i\) 的分解式为 \(i = \prod p_k^{\alpha_k}\) ,类似地,\(j = \prod
题目 题目链接:https://www.luogu.com.cn/problem/P5361 小 Q 的生日快到了,他决定周末邀请一些朋友到他的新房子一起聚会! 他的联系薄上有 \(n\) 位好友,他们两两之间或者互相认识,或者互相不认识。小 Q 希望在周六办一个热闹的聚会,再在周日办一个尴尬的聚会。 一场热闹度为 \(p\) 的
嘟嘟嘟 挺好的题 \[\begin{align*} ans &= \sum_{i = 1} ^ {a} \sum_{j = 1} ^ {b} [gcd(i, j) = d] \\ &= \sum_{i = 1} ^ {\lfloor \frac{a}{d} \rfloor} \sum_{j = 1} ^ {\lfloor \frac{b}{d} \rfloor} [gcd(i, j) = 1] \\ \end{align*}\] 令\(n =
嘟嘟嘟 学完数论分块,觉得这题不难啊。(难道是我变强了?) 推式子就行。 \[\begin{align*} G(n, k) &= \sum_{i = 1} ^ {n} k \ \ mod \ \ i \\ &= \sum_{i = 1} ^ {n} k - \left \lfloor \frac{k}{i} \right \rfloor * i \\ &= n * k - \sum_{i = 1} ^ {n} \left \lfloo
数论学习笔记 记录的侧重点为一些个人认为需要证明的性质定理,所以概念可能不成体系且跳跃 P:质数集 取模 取模的定义: \(a \bmod b = a - \lfloor \frac{a}{b} \rfloor b\) 但是注意c++的%的除法并不是向下取整,而是向零取整,这就会导致负数取模完还是负数,如: -6%5=-6-(-6/5)*5=-1
传送门 解答 官方题解: \[\begin{aligned} f(X) &= \left\lfloor\frac{\sum_{j=1}^N \min\{C_j, X\}}{X}\right\rfloor &= \left\lfloor\frac{\sum_{k=0}^N \min\{k, X\}\times D_k}{X}\right\rfloor &= \left\lfloor\frac{\sum_{k=0}^X kD_k +
题目传送门 题意: 给你一个 n ( 1 ≤ n ≤ 2 ∗
\(\mathcal{Description}\) Link. 给定 \(n,m,k\),求 \(x\in [1,n]\cap\mathbb N,y\in [1,m]\cap \mathbb N\),且最简分数 \(\frac{x}{y}\) 在 \(k\) 进制下是纯循环小数(包括整数)的 \((x,y)\) 数量。 \(n,m\le10^9\),\(k\le2\times10^3\)。 \(\mathcal{Solution}\)
题目连接 \(Description\) 求 \[\sum_{i=1}^n\sum_{j=1}^m(n\ mod\ i)(m\ mod\ i),i\neq j \]答案对\(19940417\)取模。 \(n,m\leq10^9\) \(Solution\) 如果不考虑\(i\neq j\)这个条件,根据和式的分配率答案就是 \[\sum_{i=1}^nn\ mod\ i\sum_{i=1}^mm\ mod\ i \]其中\(\sum_{i=
Gcd小练习(LuoGu) 1.P1372 又是毕业季I [ 1 , n ] [1,n] [1,n]选k个数使
众所周知,位运算是一种很强大的运算,在 OI 中有非常广泛的运用。 对于数字 (1<<n) 代表 \(2^n\) x<<1 代表 \(2\times x\) x>>1 代表 \(\left\lfloor \frac{x}{2}\right\rfloor\) x&1 结果为 \(1\) 代表奇数,为 \(0\) 代表偶数 x^1 表示将奇数变为偶数(\(-1\)),偶数变为奇数(\(
Alduhmellah and Behlah both like large numbers, lots of numbers and lots of large numbers. They also like to do calculations on those numbers. One day, Alduhmellah wrote down NN positive integers a_1, a_2,\cdots, a_Na1,a2,⋯,a**N. He decided to make them