fork download
  1. #include <bits/stdc++.h>
  2. #define MAMDOUH ios::sync_with_stdio(false); cin.tie(NULL)
  3. #define ll long long
  4. #define dd double
  5. #define ld long double
  6. #define pi 3.14159265359
  7. #define ull unsigned long long
  8. #define yes cout<<"YES\n";
  9. #define no cout<<"NO\n";
  10. #define el "\n"
  11. using namespace std;
  12.  
  13.  
  14. void solve() {
  15. ll n;
  16. cin>>n;
  17. if (n==0||n==1) {
  18. no;
  19. }
  20. else {
  21. for (ll i=2;i*i<=n;i++) {
  22. if (n%i==0) {
  23. no;
  24. }
  25. }
  26. yes;
  27. }
  28.  
  29. }
  30.  
  31. int main()
  32. {
  33. MAMDOUH;
  34. solve();
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5288KB
stdin
9
stdout
NO
YES