2019ccpc秦皇岛/Gym102361 D - Decimal 签到
题意:
给定n,判断1/n是否在十进制下无限循环
题解:
判断n的是否包含除2,5以外的因数即可
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<stack> #include<algorithm> #include<map> #include<queue> #include<vector> using namespace std; #define INF 0x3f3f3f3f #define MAXN 100000+50 #define MAXM 30000 #define ll long long #define per(i,n,m) for(int i=n;i>=m;--i) #define rep(i,n,m) for(int i=n;i<=m;++i) #define mod 1000000000 + 7 #define mian main #define mem(a, b) memset(a, b, sizeof a) #ifndef ONLINE_JUDGE #define dbg(x) cout << #x << "=" << x << endl; #else #define dbg(x) #endif inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = 10 * x + ch - '0'; ch = getchar(); } return x * f; } inline ll readll() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = 10 * x + ch - '0'; ch = getchar(); } return x * f; } int main() { int t; scanf("%d",&t); while(t--){ int n; scanf("%d",&n); while(n%5==0)n/=5; while(n%2==0)n/=2; if(n==1)printf("No\n"); else printf("Yes\n"); } }