摘要: \[ \sum_{i=1}^{n} \mu(i)\\ \sum_{i=1}^{n} \varphi(i)\\ \] 杜教筛模板: \[ S(n) = \sum_{i=1}^{n} f(i)\\ \sum_{i=1}^{n} \sum_{d|i} f(d) * g(\frac{i}{d})\\ =\s 阅读全文
posted @ 2020-07-24 20:08 zhuzihan 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Gym - 101853G 扩展BSGS模板 #include <map> #include <cmath> #include <cstdio> #include <iostream> #include <unordered_map> #define ll long long using names 阅读全文
posted @ 2020-07-24 19:49 zhuzihan 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Gym - 100883H 一共有$N$个人要乘船出行。 你有两条船,每次载人出去一次花费$c_1,c_2$,载人量为$n_1,n_2$ 船必须载满才能出行,求运送所有人的最小花费。 首先利用裴蜀定理和扩展欧几里得求出一组解。 \(n_1x + n_2y = gcd(n_1,n_2) = g\) 然 阅读全文
posted @ 2020-07-24 19:48 zhuzihan 阅读(89) 评论(0) 推荐(0) 编辑
摘要: POJ - 2480 求$\sum_\gcd(i,n)~(1\leq n\leq 109)$ 显然有 \[ \sum_{i=1}^{n}\gcd(i,n)=\sum_{d|n}d\varphi(\frac nd) \] (考虑 \(\varphi\) 的意义) 然后直接做随便做。 Code #inc 阅读全文
posted @ 2020-07-24 18:55 zhuzihan 阅读(70) 评论(0) 推荐(0) 编辑
摘要: POJ - 2478 欧拉函数求前缀和 把分数按照分母分类,每一类的个数为$\phi(分母)$ $\frac{1}{1}$特判掉 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int 阅读全文
posted @ 2020-07-24 16:33 zhuzihan 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Gym - 101727D 求欧拉函数$\phi(i)$,$i=1$时特判为$2$ #include<iostream> #include<cstdio> using namespace std; long long getphi(long long x){ long long ret=1; for 阅读全文
posted @ 2020-07-24 16:30 zhuzihan 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题目链接 裸的高斯消元求异或方程组 但是怎么考虑最少需要几条信息呢? 考虑我们寻找某列为1的行的过程,实际上就是在找最早出现的那条信息 所以只要找到后break就可以了 #include<bits/stdc++.h> using namespace std; const int N = 1050; 阅读全文
posted @ 2020-07-24 16:24 zhuzihan 阅读(150) 评论(0) 推荐(0) 编辑