Advertisement
semsem_elazazy

https://codeforces.com/group/n3sTiYtHxI/contest/348733/problem/B

Feb 28th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define ll long long
  4. #define ull unsigned long long
  5. using namespace std;
  6.  
  7. bool is_prime (ull n){
  8.     if (n<2 || (n%2 == 0 && n != 2 ))   return false ;
  9.     for(int i= 3  ; i<sqrt(n) ; i+=2){
  10.         if (n % i == 0)   return false;
  11.        
  12.     }
  13.     return true;
  14. }
  15.  
  16. int main() {
  17.    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  18.  ull n ;
  19.  cin>>n;
  20.  
  21.  if (is_prime(n))      cout<<"YES";
  22.  else                  cout<<"NO";
  23.  
  24.  
  25.  
  26.     return 0;
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement