Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ISPrime
//g++ 7.4.0 #include <iostream> using namespace std; int IP(int N) { if(N<4)return 1; if((N&1)==0 || N%3==0) return 0; long long i; int d=2; for(i=5;i*i<=N;i+=d,d=6-d) if(N%i==0)return 0; return 1; } int main() { int n; cin>>n; if(IP(n))cout<<"YES"<<endl; else cout<<"NO"<<endl; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
remove_copy_if-30-Seconds-of-C++
Best way for getting more precision no.
nobita's candies problem
printAllPathsInMatrix
sample1
Wave Sort
find duplicate in O(n)
stackLinkedlist
Lowest common ancestor in binary tree
HalumResto
Please log in to post a comment.