#P1869. Parity of Binomial Coefficient
Parity of Binomial Coefficient
Parity of Binomial Coefficient
Given two non-negative integers N and K, define the binomial coefficient \( C(N, K) \) as the number of ways to choose K elements from a set of N elements without repetition. Formally, if \( K \leq N \), then
$$ C(N, K) = \frac{N!}{K!(N-K)!} $$Otherwise, we define \( C(N, K) = 0 \). Your task is to determine the parity (odd or even) of \( C(N, K) \).
By applying Lucas' Theorem modulo 2, it can be shown that \( C(N, K) \) is odd if and only if every bit in the binary representation of K is less than or equal to the corresponding bit in the binary representation of N, i.e. if and only if
$$ N \& K = K. $$If this condition is not satisfied (or if \( K > N \)), then \( C(N, K) \) is even.
inputFormat
The input consists of a single line containing two space-separated non-negative integers N
and K
.
outputFormat
Output a single word: odd
if \( C(N, K) \) is odd, or even
otherwise.
sample
5 1
odd