其他分享
首页 > 其他分享> > CodeForces 984C Finite or not?

CodeForces 984C Finite or not?

作者:互联网

http://codeforces.com/problemset/problem/984/C

Time limit    1000 ms
Memory limit    262144 kB

题目

You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction.

A fraction in notation with base $b$ is finite if it contains finite number of numerals after the decimal point. It is also possible that a fraction has zero numerals after the decimal point.

Input

The first line contains a single integer $n$ ($1\leqslant n \leqslant 10^5$) — the number of queries.

Next

标签:984C,10,ch,frac,CodeForces,include,gc,Finite,leqslant
来源: https://www.cnblogs.com/sahdsg/p/10816117.html