​传送门​​​ 思路:只要判断该数是否和10有公共的质因子即可。
判断方法

while(t != 1) {
t = gcd(t, x);
x = x / t;
if(t % x == 0) {
flag = 1;
break;
}
}
/**
* From:
* Qingdao Agricultural University
* Created by XiangwangAcmer
* Date : 2019-10-13-16.32.30
* Talk is cheap.Show me your code.
*/
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<cctype>
#include<stack>
#include<map>
#include<string>
#include<cstdlib>
#define ll long long
using namespace std;
const ll maxn = 1e6 + 5;
const ll minn = 1e9 + 5;
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LIMIT = 4294967295LL;
vector<int>v[maxn];
int dp[maxn];
vector<int>G[maxn];
bool row[maxn], col[maxn];
bool flag = 0;
queue<int>q;
int gcd(int a,int b) {
int x;
while(b){
x=a%b;
a=b;
b=x;
}
return a;
}
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
int x;
cin >> x;
int t = 10;
int flag = 0;
while(t != 1) {
t = gcd(t, x);
x = x / t;
if(t % x == 0) {
flag = 1;
break;
}
}
if(!flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}