zoukankan      html  css  js  c++  java
  • 2019ccpc秦皇岛/Gym102361 D

    题意:

    给定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
    ");
            else printf("Yes
    ");
        }
    }
  • 相关阅读:
    Windows Python+Eclipse环境配置
    infobright系列二:数据迁移
    infobright系列一:源码安装infobright
    autotools归纳
    Atlas系列一:Atlas功能特点FAQ
    C#反射技术概念作用和要点
    .net获取本机公网IP代码
    Java泛型-类型擦除
    现在就使用HTML5的十大原因
    让网页图片变灰色的三种方法
  • 原文地址:https://www.cnblogs.com/isakovsky/p/11639955.html
Copyright © 2011-2022 走看看