Extended Euclidean inverse element Chinese remainder theorem congruence
Counting
Template:
long long mul(int a,int b,int mod)
{
long long ans=1;
while(b)
{
if(b&1) ans=ans*a%mod;
a=a*a%mod;//Pay attention to the explosion range
b>>=1;
}
return ans;
}
Fast multiplication
Template:
int mul(int a,int b,int mod)
{
int ans=0;
while(b)
{
if( ...
Posted by XxDeadmanxX on Thu, 20 Jan 2022 09:00:02 +0100
[number theory series I] C Looooops, checkers, the lucky number, cf906d, power tower, minimum power of prime, guard of honor, LCMSUM
All the number theory knowledge involved below proves portal 1
All the number theory knowledge involved below proves Portal 2
C Looooops
description
solution
Transform the meaning of the question into a mathematical formula
A
+
C
...
Posted by HektoR on Tue, 18 Jan 2022 07:44:38 +0100
Number theory difference + Lagrange interpolation lgP5430 solution
New \ (O(k+\log n) \) approach.
Consider calculating the contribution of each monkey to the answer.
Make a table:
1 1 2 4 8 16 32 ...
It can be seen that the contribution of the $I $monkey to the answer is \ (i^k \times 2^{n-i-1} \), in particular, the contribution of the last monkey to the answer is \ (n^k \).
Written as persimmon:
\[n^k+\sum ...
Posted by konn on Mon, 10 Jan 2022 10:07:50 +0100
Special test mathematics 1
A. young
The weight of the minimum spanning tree under expectation
Due to XOR, binary splitting is considered, and the contribution of each bit is considered separately
In the current bit, you must put the bits that are \ (1 \) and \ (0 \) together, and then connect the two pieces with \ (1 \) edges to connect them
Then let \ (f {n, m} \) repre ...
Posted by brissy_matty on Tue, 04 Jan 2022 21:24:48 +0100
Codeforces 1557c moamen and XOR (combinatorial thinking)
Title Link: Moamen and XOR
General meaning
Given n and k, let you construct a length of
n
n
Sequence a [], each element less than
2
k
2^k
...
Posted by mr.rum on Sat, 01 Jan 2022 19:21:54 +0100
Game theory and sg function
Game theory
Define the winning state as the winning state and the losing state as the losing state.
Through reasoning, we can get the following three theorems:
Theorem 1: a state without a successor state is a failure state.Theorem 2: a state is a winning state if and only if there is at least one losing state as its successor state.Theorem ...
Posted by vijaykoul on Sun, 28 Nov 2021 07:33:01 +0100
Polynomial Multiplication: Practice Summary
Preface
These two days, because the National Day training is all the generation function of the yin, so I learned a little bit about it. Actually I learned FFT and NTT It's a little bit of a skill. Enter the polynomial to discover the vastness of the inner world However, since none of these items are NOIP test points and don't seem to be v ...
Posted by erfg1 on Wed, 06 Oct 2021 22:26:17 +0200