Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int vPrim(int n)
- {
- if(n==2 || n==5 || n==3) return 1;
- if(n%2==0||n%5==0||n%3==0) return 0;
- if(n>5)
- {
- if((n-1)%6==0)
- {
- if(int(sqrt(n))!=sqrt(n)) return 1;
- }
- else if((n+1)%6==0)
- if(int(sqrt(n))!=sqrt(n)) return 1;
- }
- return 0;
- }
- int main()
- {
- int n;
- cin >> n;
- if(vPrim(n))
- cout << "DA";
- else cout << "NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement