摘要: 比普通幂运算更快,只需要预处理一些数就可以 普通幂: 1 int res=1; 2 for(int i=0;i<k;i++) 3 res=res*n; 4 return res; 快速幂: //快速幂:https://www.luogu.com.cn/problem/P1226 #include < 阅读全文
posted @ 2023-06-21 14:25 o-Sakurajimamai-o 阅读(20) 评论(0) 推荐(0)
摘要: 欧拉函数:指从1-n中与n互质的数的个数 首先要知道,一个数 $n$ 分解质因数之后会变成这样一个形式: $n$ = $p1k1$ + $p2k2$+ ... + $pnkn$ 而欧拉函数: $φ$= $n$ * (1-1/p1) * (1-1/p2) * ... * (1-1/pn). 证明: 1 阅读全文
posted @ 2023-06-21 14:05 o-Sakurajimamai-o 阅读(51) 评论(0) 推荐(0)
摘要: Getting Zero time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Suppose you have an integer 阅读全文
posted @ 2023-06-21 13:05 o-Sakurajimamai-o 阅读(29) 评论(0) 推荐(0)
摘要: //[POI2006] OKR-Periods of Words:https://www.luogu.com.cn/problem/P3435 //题意就是求每个子串的最小公共前后缀,也就是让我们的next数组缩到最小就可以 //这里要记忆化一下,枚举到i的时候可以直接跳到j,减少枚举次数 #inc 阅读全文
posted @ 2023-06-21 10:58 o-Sakurajimamai-o 阅读(15) 评论(0) 推荐(0)
-- --