407638: GYM102862 B Numbers on a Circle

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Numbers on a Circletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given two integers $$$n$$$ and $$$k$$$. Determine whether there exists an array $$$a_0$$$, $$$a_1$$$, $$$\ldots$$$, $$$a_{n-1}$$$ with the properties:

  • it contains all integers from the interval $$$[0,n-1]$$$ exactly once,
  • for each $$$i \in [0,n-1]$$$, we have $$$(a_i + a_{(i + 2) \pmod n}) \pmod k = 0$$$.
Input

The input contains two integers $$$n$$$ and $$$k$$$, the length of the array and the value of the modulo ($$$2 \leq n \leq 10^9$$$, $$$1 \leq k \leq 10^9$$$).

Output

If there exists such an array, output "Yes", otherwise output "No".

ExamplesInput
4 2
Output
Yes
Input
4 4
Output
No

加入题单

上一题 下一题 算法标签: