随笔分类 -  数学

AT3576 E Popping Balls——计数思路
摘要:题目:https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_e 题解:https://www.cnblogs.com/Miracevin/p/10963431.html 阅读全文

posted @ 2019-06-13 17:00 Narh 阅读(200) 评论(0) 推荐(0)

ARC093 F Dark Horse——容斥
摘要:题目:https://atcoder.jp/contests/arc093/tasks/arc093_d 阅读全文

posted @ 2019-06-11 09:44 Narh 阅读(145) 评论(0) 推荐(0)

LOJ 3093 「BJOI2019」光线——数学+思路
摘要:题目:https://loj.ac/problem/3093 考虑经过种种反射,最终射下去的光线总和。往下的光线就是这个总和 * a[ i ] 。 比如只有两层的话,设射到第二层的光线是 lst ,那么 \( lst' = ( lst + lst*b[2]*b[1] + lst*(b[2]*b[1] 阅读全文

posted @ 2019-05-29 09:26 Narh 阅读(163) 评论(0) 推荐(0)

2019.4.24 一题(CF 809E)——推式子+虚树
摘要:题目:http://codeforces.com/contest/809/problem/E 原来以为可以每个质因子分开给答案贡献。 大概就是把有这个质因子的数都拿出来建虚树,这样虚树的总点数是 nlogn 的。 定义 b[ i ] 表示 i 点原来的权值分解出的 pt ,其中 p 是目前在做的质因 阅读全文

posted @ 2019-04-24 21:33 Narh 阅读(147) 评论(0) 推荐(0)

2019.4.18 一题——DP+容斥
该文被密码保护。

posted @ 2019-04-18 20:32 Narh 阅读(2) 评论(0) 推荐(0)

bzoj 4772 显而易见的数论——拆分数(五边形数定理)+线性筛
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4772 题解:https://blog.csdn.net/Dream_Lolita/article/details/82314788 关于 \( g[p^t] \) 的值是多少,提供自己的见解: 阅读全文

posted @ 2019-02-21 17:55 Narh 阅读(438) 评论(0) 推荐(0)

hdu 4651 Partition && hdu 4658 Integer Partition——拆分数与五边形定理
摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=4651 参考:https://blog.csdn.net/u013007900/article/details/42365823 https://blog.csdn.net/visit_world/artic 阅读全文

posted @ 2019-02-20 21:11 Narh 阅读(298) 评论(0) 推荐(0)

bzoj 3157 && bzoj 3516 国王奇遇记——推式子
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3157 https://www.lydsy.com/JudgeOnline/problem.php?id=3516 题解:http://blog.miskcoo.com/2014/06/bzoj 阅读全文

posted @ 2018-12-16 20:07 Narh 阅读(284) 评论(0) 推荐(0)

bzoj 1257 [CQOI2007]余数之和——数论分块
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1257 \( n\%i = n - \left \lfloor n/i \right \rfloor * i \) 注意 n<k 时当前块的右端点可能超过 n ! 阅读全文

posted @ 2018-12-13 08:40 Narh 阅读(166) 评论(0) 推荐(0)

bzoj 5092 [Lydsy1711月赛]分割序列——高维前缀和
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=5092 套路地弄一个前缀异或和,就变成 f[ i ]=max_{j=0}^{i} { s[ j ] + (s[ i ]^s[ j ]) }。再套路地考虑按位贪心。 然后看了题解。按位贪心不是确定 阅读全文

posted @ 2018-11-28 00:00 Narh 阅读(136) 评论(0) 推荐(0)

bzoj 1607 [Usaco2008 Dec]Patting Heads 轻拍牛头——枚举倍数
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1607 阅读全文

posted @ 2018-11-01 07:42 Narh 阅读(126) 评论(0) 推荐(0)

CF 757E Bash Plays with Functions——积性函数+dp+质因数分解
摘要:题目:http://codeforces.com/contest/757/problem/E f0[n]=2^m,其中m是n的质因子个数(种类数)。大概是一种质因数只能放在 d 或 n/d 两者之一。 然后应该发现因为 f0 是积性的,所以 fr 也是积性的!因为是卷积得来的。 这样就能把每个质因数 阅读全文

posted @ 2018-10-12 10:41 Narh 阅读(172) 评论(0) 推荐(0)

洛谷 1072 Hankson 的趣味题——质因数界限讨论
摘要:题目:https://www.luogu.org/problemnew/show/P1072 思路是把每个数质因数分解,答案对于每个质因数的次数有选择的区间,通过这个计算。 指数的限制就是上限是b1,下限是a1;a0-a1后有剩余的自己不能有;b1-b0有剩余的自己不能剩(即必须满上限)。 分解质因 阅读全文

posted @ 2018-10-09 18:54 Narh 阅读(259) 评论(0) 推荐(0)

bzoj 1045 [HAOI2008] 糖果传递——设变量推式子
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1045 费用流TLE。 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<qu 阅读全文

posted @ 2018-08-01 16:46 Narh 阅读(159) 评论(0) 推荐(0)

bzoj 1053 [HAOI2007]反素数ant——关于质数的dfs / 打表
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1053 写了个打表程序。 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using name 阅读全文

posted @ 2018-07-25 10:30 Narh 阅读(208) 评论(0) 推荐(0)

poj 2262 Goldbach's Conjecture——筛质数(水!)
摘要:题目:http://poj.org/problem?id=2262 大水题的筛质数。 阅读全文

posted @ 2018-07-07 17:22 Narh 阅读(122) 评论(0) 推荐(0)

bzoj 3629 [JLOI2014]聪明的燕姿——约数和定理+dfs
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3629 如果要搜索,肯定得质因数分解吧;就应该朝这个方向想。 **约数和定理: 对于任意一个大于1的正整数N可以分解正整数:N=P₁^a₁ P₂^a₂…Pn^an,则由约数个数定理可知N的正约数 阅读全文

posted @ 2018-07-04 21:32 Narh 阅读(142) 评论(0) 推荐(0)

poj 3421 X-factor Chains——质因数分解
摘要:题目:http://poj.org/problem?id=3421 记忆化搜索竟然水过去了。仔细一想时间可能有点不对,但还是水过去了。 #include<iostream> #include<cstdio> #include<cstring> #define ll long long using n 阅读全文

posted @ 2018-07-04 20:10 Narh 阅读(177) 评论(0) 推荐(0)

bzoj 1951 [Sdoi2010]古代猪文 ——数学综合
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1951 数学综合题。 费马小定理得指数可以%999911658,又发现这个数可以质因数分解。所以分解做完再用中国剩余定理合并。 为什么不能预处理阶乘的逆元? 为什么正常的中国剩余定理会T?非得两 阅读全文

posted @ 2018-07-02 21:07 Narh 阅读(116) 评论(0) 推荐(0)

bzoj1025(SCOI2009)游戏——唯一分解的思路与应用
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1025 可以认为对应的值之间连边,就连成了一个有一个或几个环的图。列数就是每个环里点数的lcm的和+1。 所以问题转化为和为n的数列的lcm种类数。 然后就看了TJ。这个人写得真的很好。http 阅读全文

posted @ 2018-06-06 10:47 Narh 阅读(123) 评论(0) 推荐(0)

导航