摘要: //中国剩余定理 # include <bits/stdc++.h>using namespace std;​typedef long long LL;const int MAXN=50;LL a[MAXN];LL b[MAXN];int k;LL mul(LL a,LL b,LL mod){ LL 阅读全文
posted @ 2022-02-26 23:18 fengzlj 阅读(37) 评论(0) 推荐(0)
摘要: //求逆元//扩展gcd//1.65s# include <bits/stdc++.h>using namespace std;int exgcd(int a,int b,int &x,int &y){ if (b==0) { x=1,y=0;return a; } int d=exgcd(b,a% 阅读全文
posted @ 2022-02-26 23:17 fengzlj 阅读(26) 评论(0) 推荐(0)
摘要: # include <bits/stdc++.h>using namespace std;typedef long long LL;LL quick_pow(LL a,LL b,LL mod){ LL ret=1; while(b) { if(b&1) ret=ret*a%mod; a=a*a%mo 阅读全文
posted @ 2022-02-26 23:17 fengzlj 阅读(41) 评论(0) 推荐(0)
摘要: 五大基础博弈论 Nim 博弈 【题意】有n堆石子,每堆ai个石头,每个人任意可以选取一堆,取走任意多个,可以把一堆取光,但是不能不取,取走最后一个的人获胜。 【题解】a1^a2^……^an==0 先手必输 # include <bits/stdc++.h>using namespace std;​c 阅读全文
posted @ 2022-02-26 23:17 fengzlj 阅读(170) 评论(0) 推荐(0)
摘要: //数学备忘录 //数学 //素数 //判定素数​bool Is_prime(int n){ if(n==1) return false; if(n==2||n==3) return true; if(n%6!=1&&n%6!=5) return false; for(register int i= 阅读全文
posted @ 2022-02-26 23:16 fengzlj 阅读(30) 评论(0) 推荐(0)
摘要: A The Fool 签到题 数论分块 数学题 B The World 时间处理问题 字符串 C Justice 思维题 E The Tower 计算几何 几何题 I Strength 贪心+田忌赛马 博弈论 A The Fool 数论分块(队友写的,所以没有解析) # include <bits/ 阅读全文
posted @ 2022-02-26 23:15 fengzlj 阅读(51) 评论(0) 推荐(0)
摘要: 矩阵乘法 //矩阵乘法,斐波那契数列# include <bits/stdc++.h>using namespace std;​typedef long long LL;const LL mod=1e9+7;inline void mul(LL f[2],LL a[2][2]){ LL c[2]; 阅读全文
posted @ 2022-02-26 23:15 fengzlj 阅读(52) 评论(0) 推荐(0)
摘要: A Super-palindrome 找规律+回文子串 字符串 B Master of Phi 积性函数+欧拉函数 数学题 C Hakase and Nano 博弈论 D Master of Random 找规律+逆元 数学题 J Master of GCD 数论gcd A Super-palind 阅读全文
posted @ 2022-02-26 23:15 fengzlj 阅读(41) 评论(0) 推荐(0)
摘要: 杜教筛 此处为莫比乌斯函数和欧拉函数的 # include <bits/stdc++.h>using namespace std;​typedef long long LL;typedef unsigned long long ULL;const int MAXN=5e6;int v[MAXN+10 阅读全文
posted @ 2022-02-26 23:13 fengzlj 阅读(69) 评论(0) 推荐(0)
摘要: //二次剩余 //一般是求 x^2=n(mod p) 的解的,其中一般是保证p为奇素数,但是这套板子还处理了2的情况,把素数的情况大部分都包含了# include <bits/stdc++.h>using namespace std;typedef long long LL;# define ran 阅读全文
posted @ 2022-02-26 23:13 fengzlj 阅读(43) 评论(0) 推荐(0)