2019CCPC秦皇岛(重现赛)-D

链接:

http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1004&cid=872

题意:

给定一个正整数 n,要求判断 1n 在十进制下是不是一个无限小数。如果是,输出“Yes”,否则输出“No”。

思路:

题解是只有2和5的质数.
直接1e9模一下判断就好(逃.

代码:

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
    {
        int n;
        scanf("%d", &n);
        if (1000000000%n == 0)
            puts("No");
        else
            puts("Yes");
    }

    return 0;
}
原文地址:https://www.cnblogs.com/YDDDD/p/11604840.html