版本比较
绝世【】题
正文
增加 11 行删除 11 行
10 行未改动1112131415151617181919202122222324242526262728293018 行未改动495051525353545556573 行未改动616263646565666768686970717211 行未改动8485868788898889909192935 行未改动991001011021031031041051061073 行未改动10 行未改动你这家伙在说什么呢
# 化简
令 $S = \{d,r,e,a,m\}$,那么分子为 令 $S = \{d,r,e,a,m\}$,那么分子为$$G_1=\prod_{T\subset S,|T|=3}\gcd(T)$$分母前一段为$$G_2^3,G_2=\gcd(\{x|x=\operatorname{lcm}(T),T\subset S,|T|=2\})$$后面是 后面是$$G_3=\gcd(\{x|x=\operatorname{lcm}(T),T\subset S,|T|=3\})$$
用 $v_p(x)$ 表示 $p$ 这个质数在 $x$ 中的指数,那么根据 用 $v_p(x)$ 表示 $p$ 这个质数在 $x$ 中的指数,那么根据$$v_p(\gcd(x,y))=\min(v_p(x),v_p(y)),v_p(\operatorname{lcm}(x,y))=\max(v_p(x),v_p(y))$$对于某一质数 $p$,简写 $v_x=v_p(x)$,则在 $G_1$ 中的指数就是 对于某一质数 $p$,简写 $v_x=v_p(x)$,则在 $G_1$ 中的指数就是$$g_1=\sum_{T\subset S,|T|=3}\min\{v_x:x\in T\}$$在 $G_2$ 中就是 在 $G_2$ 中就是$$g_2=\min_{\{i,j\}\subset S}\max(v_i,v_j)$$在 $G_3$ 中就是$$g_3=\min_{T\subset S,|T|=3}\max\{v_x:x\in T\}$$于是原分数对 $p$ 的指数就是18 行未改动 & = \sum_{d=1}^D\sum_{r=1}^R\sum_{e=1}^E\sum_{a=1}^A\sum_{m=1}^M\sum_{x|\gcd(d,r,e,a,m)}f(x) \\\end{aligned}$$这里 $f(x)$ 是 $g(x)$ 的狄利克雷逆,即 $g(x)=\sum_{d|x}f(d)$,由于 $g(x)=x^6$,那么 $f(x)=\sum_{d|x}\mu(d)(\frac{x}{d})^6$,发现 $f(x)$ 可以线性筛
交换一下求和顺序 交换一下求和顺序$$原式=\sum_{x=1}^{\min(D,R,E,A,M)}f(x)\left\lfloor\frac{D}{x}\right\rfloor\left\lfloor\frac{R}{x}\right\rfloor\left\lfloor\frac{E}{x}\right\rfloor\left\lfloor\frac{A}{x}\right\rfloor\left\lfloor\frac{M}{x}\right\rfloor$$看起来人畜无害多了,是五个整除分块,于是就能写了
3 行未改动#include <bits/stdc++.h>#define eps 1e-12#define inf LONG_LONG_MAX#define endl '\n'using namespace std; using namespace std;#define ll long long
const int maxn = 5e7 + 10, mod = 1e9 + 7; const int maxn = 5e7 + 10, mod = 1e9 + 7;int pr[maxn], ntp[maxn], f[maxn], cnt;int get(int x) { x = (ll)x * x % mod; return (ll)x * x % mod * x % mod;11 行未改动 } for (int i = 1; i < maxn; i++) if ((f[i] += f[i - 1]) >= mod) f[i] -= mod;}signed main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); init(); int t; cin >> t; while (t--) {5 行未改动 (ans += (ll)(f[_r] - f[l - 1] + mod) * (d / l) % mod * (r / l) % mod * (e / l) % mod * (a / l) % mod * (m / l) % mod) %= mod; } cout << ans << endl; } return 0; return 0;}```---啊啊啊宝宝你是一个3 行未改动