摘要:
最大公约数$\gcd$ 求最大公约数有两种方法,一种是辗转相除法,另一种是更相减损法 辗转相除法 \(\gcd(a, b) = \gcd(b, a\mod b)\) 更相减损法 \(\gcd(a, b) = \gcd(a-b, b)\) 欧拉函数$\varphi$ \(\varphi(n)\) 表示 阅读全文
摘要:
ll rand_int(ll l, ll r) { //[l, r] #ifdef LOCAL static mt19937_64 gen; #else static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().coun 阅读全文
摘要:
CF717D Dexterina’s Lab 题意:有一个 \(n\) 堆石子的 \(nim\) 游戏,石子数量从 \(0\) 到 \(x\) 有一个概率 \(p_i\) ,代表了一堆石子数量为 \(i\) 的数量。求先手必赢的概率。 题解:首先nim显然的是 \(nim\) 异或和为 \(0\) 阅读全文
摘要:
const ll maxn = 10; struct Matrix { ld a[maxn][maxn]; int n; Matrix (int sz, int kind) { this->n = sz; for (int i = 0; i < sz; i ++) { for (int j = 0; 阅读全文
摘要:
const ll maxn = 1e6 + 9; ll st[maxn][25]; ll sst[maxn][25]; ll ssg[maxn][25]; ll LOG2[maxn]; ll query_max(ll l, ll r) { ll k = LOG2[r - l + 1]; return 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int N = 9000000; const ld pi = acos(-1); struct CP { 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 1e6 + 9; ll a[N]; vector<ll>G[N]; ll sz[N], Son[N]; ll Max= -1; ll co; 阅读全文
摘要:
原题链接 题意:给出正四面体棱长 \(a\) 并且给出以正四面体为中心的半径 \(r\),求出以正四面体中心为球心,给出的半径 \(r\) 为半径求平面相交面积。 题解:当我复习了一下正三棱锥和正四面体,并且顺便看了一下2019年全国一的数学第12道填空,然后这道题就切掉了。 代码: #includ 阅读全文
摘要:
树链剖分 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 9; template <typename T> inline void read(T &x) { register 阅读全文
摘要:
*原题链接 题意:要求出所有 \(1 \leqslant x\leqslant n\) 的范围内,能整除 \(8\) 的所有数的数字 \(8\) 和 \(6\) 出现的数量。 题解:神似数位 \(dp\) 要做的事情,但是因为不连续,所以没有想法。并且数据范围也暗示了是数位dp。然后赛后通过讲解,知 阅读全文