Some personal knowledge points gained from each question (point out if there is any mismatch)
One number theory:
1. If a number has no odd factors, then it must be a power of 2
(cf #697 (Div. 3) A)
2. And operator (&)
(precedence is lower than ==, be sure to pay attention to the parentheses)
both are 1, and the result is 1, otherwise it is 0;
The special purpose of "and operation":
(1) Clear to zero.
If you want to clear a unit, even if all its binary bits are 0, as long as it is ANDed with a value whose bits are all zero, the result is zero.
(2) Take the specified digit in a number
Method: Find a number that corresponds to the digit of X. The corresponding digit of the number is 1, and the remaining digits are zero. Performing an "AND operation" between this number and X can get the specified digit in X.
Example: Set X=10101110,
Take the lower 4 bits of X and use X & 0000 1111 = 00001110 to get;
It can also be used to take the 2, 4, and 6 bits of X.
(3) Judge whether n has an odd factor (1 does not count
if((n)&(n-1))cout<<"YES";
else cout<<"NO";
3. The greatest common divisor
2019CCPC
if x+y=sum;
gcd(x,y)=gcd(x,sum)=gcd(y,sum);
4. Prefix and find the multiple of k.
Use an array to store the result of taking the remainder of the value. When the two values are the same, then this interval can definitely constitute an integer multiple of K.
Xiaobao's lucky array
K times interval
Two game theory:
Reprinted: Introduction to Game Theory
Three strings:
1. lexicographical ordering
a very interesting title fight number
Four searches:
1. Recursive and full permutation
link
2. Number combination
link