当前位置:网站首页>无限循环判断方法;
无限循环判断方法;
2022-06-12 02:55:00 【HENU_Lzey】
无限循环判断方法;
例题:2019新生狂欢赛B题
```cpp
#include<iostream>
using namespace std;
int w[110];
int beichu(int n){
while(n%2==0){
n=n/2;//是否为无限小数,含除1,2,5,本身外的因子,就是无限小数; 同理不含就不是;
}while(n%5==0){
n=n/5;
}return n;
}
int sushu(int n){
if(n==1){
return 1;
}else {
for(int i=2;i<=n;i++){
if(n%i==0){
return 2;
}
}return 1;
}
}
int main(){
int t,n;
cin>>t;
for(int i=0;i<t;i++){
cin>>n;
n=beichu(n);
n=sushu(n);
w[i]=n;
}
for(int i=0;i<t;i++){
if(w[i]==1)cout<<"No"<<endl;
else if(w[i]==2)cout<<"Yes"<<endl;
}
return 0;
}
注意:
1.只看最简分数的分母是否含除1,2,5,本身外的因子,含就是无限小数;
不含就不是;
## 无限循环判断
边栏推荐
- PHP life cycle and swoole life cycle
- (9) Serial port interrupt
- 安科瑞抗晃电产品在河北某化工项目的应用
- Audio and video technology under the trend of full true Internet | Q recommendation
- Wave view audio information
- Oracle schema object
- What are the solutions across domains?
- ZABBIX notes: 6.0 lts source code installation
- Maya foreground rendering plug-in Mel scripting tool
- Force deduction solution summary 467- unique substring in surrounding string
猜你喜欢

Start ticwatch2

Apache simple honeypot

MySQL partition table create delete modify view

DbNull if statement - DbNull if statement

Cvpr2022 | IFS RCNN: an incremental small sample instance splitter
![[point cloud compression] variable image compression with a scale hyperprior](/img/d4/4084f64d20c8e622cddef2310d3b6c.png)
[point cloud compression] variable image compression with a scale hyperprior

Getting started with RPC

Machine learning - dimensionality reduction (data compression, data visualization)

Acl2022 | DCSR: a sentence aware contrastive learning method for open domain paragraph retrieval

Maya Front Office Rendering plug - in Mel script Tool
随机推荐
I2C协议概述
[digital signal processing] correlation function (energy signal | cross correlation function of energy signal | autocorrelation function of energy signal)
Selection (046) - what is the output of the following code?
I2C protocol overview
How to build urban smart bus travel? Quick code to answer
Acl2022 | DCSR: a sentence aware contrastive learning method for open domain paragraph retrieval
xml
Package a mobile APK app containing watch app - ticwear
2022 western style pastry (technician) recurrent training question bank and online simulated examination
Exemple de projet d'applet Wechat - calculatrice de constitution
Comment prévenir les incendies électriques dans les centres commerciaux?
Min25 sieve
Force deduction solution summary 699- dropped blocks
Introduction to architecture - who moved my cake
Apache simple honeypot
Unique paths for leetcode topic resolution
Getting started with RPC
推荐6款办公软件,好用还免费,效率翻倍
中国银屑病药物市场评估与投资方向研究报告(2022版)
如何防止商场电气火灾的发生?