teamnote default

This commit is contained in:
2026-06-03 09:20:51 +09:00
commit f50ed902fe
65 changed files with 6033 additions and 0 deletions

13
source/Math/CRT.cpp Normal file
View File

@@ -0,0 +1,13 @@
pll crt(pll p, pll q) {
if(p.fi > q.fi) swap(p, q);
auto [a, A] = p;
auto [b, B] = q;
ll g = gcd(A, B);
if((b-a)%g != 0) return {-1, -1};
ll i = A, j = B, k = b-a;
i/=g; j/=g; k/=g;
auto [x, y] = diophantos(i, j);
return {(ll)((a+(lll)A*k*x)%(A*B/g)), A*B/g};
}