anon20016

L

Oct 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <map>
  4. #include <vector>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. #define li long long
  10.  
  11. bool isprime(long long n) {
  12. for (long long i = 2; i * i <= n; i++) {
  13. if (n % i == 0) {
  14. return 0;
  15. }
  16. }
  17. return 1;
  18. }
  19.  
  20. int main() {
  21. int i;
  22. cin >> i;
  23. if (isprime(i)) {
  24. cout << "YES";
  25. }
  26. else {
  27. cout << "NO";
  28. }
  29.  
  30.  
  31. return 0;
  32. }
Add Comment
Please, Sign In to add comment