当前位置:网站首页>L1-028 judging prime number (10 points)
L1-028 judging prime number (10 points)
2022-07-04 07:29:00 【Inter personal liabilities^】
L1-028 Judgement primes (10 branch )
The goal of this question is very simple , Is to determine whether a given positive integer is a prime number .
Input format :
Enter a positive integer on the first line N
(≤ 10), And then N
That's ok , Each line gives a less than 2 31 A positive integer that needs to be judged .
Output format :
For each positive integer to be judged , If it's a prime , Output in one line Yes
, Otherwise output No
.
sample input :
2
11
111
sample output :
Yes
No
Test point 1:231, Must open long long Range ,1 Not primes , This is a special judgment , There is something wrong with this topic ,1 It should be neither prime nor prime
AC Code
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
typedef long long ll;
const int N=100010;
int main()
{
int n;
cin >> n;
while(n -- )
{
ll x;
cin >> x;
bool flag = false;
if(x == 1) flag = true;
for(int i = 2; i < sqrt(x); i ++ )
{
if(x % i == 0)
{
flag = true;
break;
}
}
if(flag) cout << "No" << endl;
else cout << "Yes" << endl;
}
return 0;
}
边栏推荐
- [real case] how to deal with the failure of message consumption?
- 时序数据库 InfluxDB 2.2 初探
- MYCAT middleware installation and use
- Crawler (III) crawling house prices in Tianjin
- Solution of running crash caused by node error
- 提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
- Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!
- Types of references in BibTex
- Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
- Rapidjson reading and writing JSON files
猜你喜欢
BUUCTF(4)
[C language] open the door of C
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
com. alibaba. nacos. api. exception. NacosException
BUUCTF(3)
Advanced MySQL: Basics (5-8 Lectures)
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
System architecture design of circle of friends
Vulhub vulnerability recurrence 76_ XXL-JOB
随机推荐
Tri des fonctions de traitement de texte dans MySQL, recherche rapide préférée
Pangu open source: multi support and promotion, the wave of chip industry
[MySQL transaction]
MySQL中的文本处理函数整理,收藏速查
Novel website program source code that can be automatically collected
There is no Chinese prompt below when inputting text in win10 Microsoft Pinyin input method
The most effective futures trend strategy: futures reverse merchandising
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Adaptive spatiotemporal fusion of multi-target networks for compressed video perception enhancement
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
Go learning notes - constants
The IP bound to the socket is inaddr_ The meaning of any htonl (inaddr_any) (0.0.0.0 all addresses, uncertain addresses, arbitrary addresses)
This monitoring system can monitor the turnover intention and fishing all, and the product page has 404 after the dispute appears
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
Data double write consistency between redis and MySQL
两年前美国芯片扭捏着不卖芯片,如今芯片堆积如山祈求中国帮忙
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
【Kubernetes系列】Kubernetes 上安装 KubeSphere
Label management of kubernetes cluster
大学阶段总结