This is the content of Newton's binomial theorem
What you said upstairs is good.
In fact, you can directly translate it into permutation and combination:
3 1, that is, 3 people choose 1, and the number of selection methods is odd or even.
4 2, that is, 2 out of 4 people are selected, and the method of judging the number of candidates is odd or even.
C(3, 1)=3, odd number. C (4,2) = 6, even number.
C(n, k)%2 == 1 or ==0?
Since k and n are very large, the following formula should be used:
(A/B)% K =(A %(B * K))/B;
(A * B)% K =((A % K)*(B % K))% K;