Finate Demical

发布时间: 2018年12月8日 20:11   最后更新: 2018年12月8日 20:13   时间限制: 1000ms   内存限制: 512M

Given a decimal fraction in the form of $\frac{1}{q}$, we want to figure out if it can be represented by a finite decimal in $k$ base, where $k, q$ are positive integers and $k$ is greater than $1$. 

Display "Yes" if it is, or "No" otherwise(without quotes).

A single line with two integers $q,k(1 \le q,k \le 10^9)$.

Display "Yes" or "No"(without quotes).

复制
1024 10
Yes
复制
10 6
No

In the first sample, $\frac{1}{1024}$ equals to $0.0009765625$ in 10-base, which is a finite decimal.

In the second sample, $\frac{1}{10}$ equals to $0.03333\cdots$ in 6-base, which is an infinte decimal.

2018 fdupc

2018 FDUPC 程序设计校赛现场赛(网络同步赛)