Decimal

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 103    Accepted Submission(s): 49

Problem Description
Given a positive integer n, determine if 1n is an infinite decimal in decimal base. If the answer is yes, print “Yes” in a single line, or print “No” if the answer is no.
 
Input
The first line contains one positive integer T (1 ≤ T ≤ 100), denoting the number of test cases.
For each test case:
Input a single line containing a positive integer n (1 ≤ n ≤ 100).
 
Output
Output T lines each contains a string “Yes” or “No”, denoting the answer to corresponding test case.
 
Sample Input
2
5
3
 
Sample Output
No
Yes

Hint

1/5 = 0.2, which is a finite decimal.
1/3 = 0.333 · · · , which is an infinite decimal.

 
Source

题解:
问1/n是否是有限小数,队友很快反应过来找n是否含有非2和非5的因子。
参考代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
if(n%==)
{
do{
n/=;
}while(n%==);
}
if(n%==)
{
do{n/=;}while(n%==);
}
if(n==) puts("No");
else puts("Yes");
}
return ;
}

2019CCPC秦皇岛D题 Decimal的更多相关文章

  1. 2019CCPC秦皇岛 E题 Escape(网络流)

    Escape Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Su ...

  2. 2019CCPC秦皇岛I题 Invoker(DP)

    Invoker Time Limit: 15000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total ...

  3. 2019ccpc秦皇岛/Gym102361 D - Decimal 签到

    题意: 给定n,判断1/n是否在十进制下无限循环 题解:判断n的是否包含除2,5以外的因数即可 #include<iostream> #include<cstdio> #inc ...

  4. 2019-ccpc秦皇岛现场赛

    https://www.cnblogs.com/31415926535x/p/11625462.html 昨天和队友模拟了下今年秦皇岛的区域赛,,,(我全程在演 题目链接 D - Decimal 签到 ...

  5. 2019CCPC秦皇岛 J MUV LUV EXTRA(KMP)

    MUV LUV EXTRA Time Limit: 2000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)T ...

  6. 2017 CCPC秦皇岛 M题 Safest Buildings

    PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parach ...

  7. 2017 CCPC秦皇岛 L题 One Dimensions Dave

    BaoBao is trapped in a one-dimensional maze consisting of  grids arranged in a row! The grids are nu ...

  8. 2017 CCPC秦皇岛 A题 A Ballon Robot

    The 2017 China Collegiate Programming Contest Qinhuangdao Site is coming! There will be  teams parti ...

  9. 2019CCPC秦皇岛自我反省&部分题解

    练了一年半了,第一次打CCPC,险些把队友坑了打铁,最后也是3题危险捡了块铜. 非常水的点双连通,我居然不相信自己去相信板子,唉,结果整来整去,本来半个小时能出的题,整到了3个小时,大失误呀,不然就可 ...

随机推荐

  1. Git如何fork别人的仓库并作为贡献者提交代码

    例如 要fork一份google的MLperf/inference代码,下面介绍具体做法:预备知识git里的参考有几种表示,分别是上游仓库,远程仓库和本地仓库,逻辑关系如下拉取代码的顺序:别的大牛的代 ...

  2. My First Cloud Application's Design

    Structure Diagram as following: Questions list: 1. Skydrive Integration > Based on the MSDN commu ...

  3. JenKins结合cppcheck及cpplint进行代码风格及静态代码检测

    JenKins结合cppcheck及cpplint 最近公司需要在Jenkins上安装cppcheck及cpplint进行代码风格及静态代码检测,这里记录下过程. 前提条件 安装了Jenkins 步骤 ...

  4. javascript jquery 修改指定标签中的内容

    javascript jquery 修改指定标签中的内容 $("#test1").text("Hello world!"); document.getEleme ...

  5. ZeroC ICE的远程调用框架 代理引用地址

    在官方文档中称为Binding,协议-地址对的绑定.在Proxy模式中,一般地有三个参与者,Proxy,Subject以及RealSubject.Subject定义了Proxy(代理)和RealSub ...

  6. Windows 10上源码编译Poco并编写httpserver和tcpserver | compile and install poco cpp library on windows

    本文首发于个人博客https://kezunlin.me/post/9587bb47/,欢迎阅读! compile and install poco cpp library on windows Se ...

  7. 护网杯一道crypto

    import os def xor(a,b): assert len(a)==len(b) c="" for i in range(len(a)): c+=chr(ord(a[i] ...

  8. es6 filter方法应用

    let arr =[ {title:'aaaa',read:100,hot:true}, {title:'bbbb',read:50,hot:false}, {title:'ccc',read:100 ...

  9. jquery对类的操作,添加,删除,点击添加,再点击删除

    jquery对类的操作,添加(addClass),删除l类(remoceClass),点击添加,再点击删除(toggleClass)

  10. 记一次uboot中gunzip解压速度慢的问题排查

    背景 在项目中需要用到解压功能,之前还记录了下,将uboot解压代码移植到另外的bootloader中时,碰到的效率问题.最终查明是cache的配置导致的. https://www.cnblogs.c ...