#T357. 判断元素是否存在
判断元素是否存在
Description
A set M is generated as follows: (1) It is known that k is an element of set M; (2) If y is an element of M, then both 2y+1 and 3y+1 are elements of M; (3) Apart from the above two cases, no other numbers can become elements of M.
Problem: For any given k and x, determine whether x is an element of M. Here, k is an unsigned integer, and x does not exceed 100,000. If x is an element of M, output "YES"; otherwise, output "NO".
Input Format
Input integers k and x, separated by a comma.
Output Format
If x is an element of M, output "YES"; otherwise, output "NO".
0,22
YES