上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页
摘要: ```cpp inline ll gcd(ll a,ll b) { if(!b) return a; else { while(1) { ll t=a%b; if(t==0) return b; else { a=b... 阅读全文
posted @ 2019-06-11 10:53 韵意 阅读(204) 评论(0) 推荐(0) 编辑
摘要: https://scut.online/p/114 $A(n)=\sum\limits_{i=1}^{n} \frac{lcm(i,n)}{gcd(i,n)}$ $=\sum\limits_{i=1}^{n} \frac{in}{gcd^2(i,n)}$ 枚举g: $A(n)=n\sum\limit 阅读全文
posted @ 2019-06-10 23:23 韵意 阅读(166) 评论(0) 推荐(0) 编辑
摘要: https://scut.online/p/362 和LCA差不多,注意开大点不怕浪费。 include using namespace std; typedef long long ll; const int MAXN=1e5; int head[MAXN+1],nxt[2 MAXN+1],to[ 阅读全文
posted @ 2019-06-10 20:37 韵意 阅读(301) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P3768 $F(n)=\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}ijgcd(i,j)$ 首先加入方括号并枚举g,提gcd的g: $\sum\limits_{g=1}^{n}g\su 阅读全文
posted @ 2019-06-10 17:01 韵意 阅读(249) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P4861 把好像把一开始b==1的特判去掉就可以AC了。 cpp include using namespace std; typedef long long ll; inline int gcd(int a,int b) 阅读全文
posted @ 2019-06-10 16:43 韵意 阅读(170) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P4449 $F(n)=\sum\limits_{i=1}^{n}\sum\limits_{i=1}^{m} gcd(i,j)^k$ 首先加方括号,枚举g,提g:($min$表示$min(n,m)$) $\sum\limit 阅读全文
posted @ 2019-06-10 15:51 韵意 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 另一道数据范围不一样的题:https://www.cnblogs.com/Yinku/p/10987912.html $F(n)=\sum\limits_{i=1}^{n} lcm(i,n) $ $\sum\limits_{i=1}^{n} \frac{in}{gcd(i,n)} $ 枚举g,提n。 阅读全文
posted @ 2019-06-10 15:19 韵意 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 易得 $\sum\limits_{g=1}^{n} g \sum\limits_{k=1}^{n} \mu(k) \lfloor\frac{n}{gk}\rfloor \lfloor\frac{n}{gk}\rfloor $ 记 $T=gk$ 枚举 $T$ ,注意这里既然满足 $T=gk$ 要保证两 阅读全文
posted @ 2019-06-08 12:30 韵意 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 类似的因为模数比较小的坑还有卢卡斯定理那道,也是有时候逆元会不存在,因为整除了。使用一些其他方法避免通过逆元。 https://www.luogu.org/fe/problem/P1593 有坑。一定要好好理解费马小定理等逆元存在的条件。费马小定理求逆元的条件是p是质数且a不为0,扩展欧几里得算法的 阅读全文
posted @ 2019-06-08 03:44 韵意 阅读(261) 评论(0) 推荐(0) 编辑
摘要: https://www.51nod.com/Challenge/Problem.html ! problemId=1363 求$\sum\limits_{i=1}^{n}lcm(i,n)$ 先换成gcd: $\sum\limits_{i=1}^{n}\frac{i n}{gcd(i,n)}$ 显而易 阅读全文
posted @ 2019-06-07 11:57 韵意 阅读(304) 评论(0) 推荐(0) 编辑
摘要: https://www.51nod.com/Challenge/Problem.html ! problemId=1188 求$\sum\limits_{i=1}^{n 1}\sum\limits_{j=i+1}^{n}gcd(i,j)$ 首先交换求和$\sum\limits_{j=2}^{n}\s 阅读全文
posted @ 2019-06-07 00:51 韵意 阅读(183) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2019-06-06 23:33 韵意 阅读(65) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P2283 需要注意max是求解顺序是从右到左,最好保证安全每次都清空就没问题了。 include using namespace std; typedef long long ll; //不要输出 0.0之类的数 cons 阅读全文
posted @ 2019-06-06 22:19 韵意 阅读(176) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P2278 题目没有说同时到达的优先级最大的应该处理谁。 讲道理就是处理优先级最大的。 阅读全文
posted @ 2019-06-06 18:20 韵意 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 为什么估价是16,因为最后一步复原空格可以恢复两个位置,当然设成17、18都可以。 阅读全文
posted @ 2019-06-05 10:51 韵意 阅读(205) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页