fork download
  1. /*
  2. ==> Don't stop when you're tired, stop when you're done.
  3. --> @author: MIDORIYA_
  4. */
  5. //*==============================================================
  6. #include <bits/stdc++.h>
  7. using namespace std;
  8. typedef long long ll;
  9. typedef double db;
  10. typedef long double ld;
  11. typedef pair<int, int> pii;
  12. typedef vector<int> vi;
  13. typedef vector<ll> vll;
  14. typedef vector<db> vd;
  15. typedef vector<ld> vld;
  16. typedef vector<bool> vb;
  17. typedef vector<vector<ll>> vvl;
  18. typedef vector<pii> vii;
  19. typedef set<int> si;
  20. typedef set<ll> sl;
  21. #define pb push_back
  22. #define all(x) x.begin(), x.end()
  23. #define rall(x) x.rbegin(), x.rend()
  24. #define endl "\n"
  25. const ll mod = 1'000'000'007;
  26. #define INF 2'000'000'000
  27. #define time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << endl;
  28. //*===================>>>Fast-IO-Functions<<<=================
  29. void fastIO()
  30. {
  31. ios_base::sync_with_stdio(false);
  32. cin.tie(nullptr);
  33. cout.tie(nullptr);
  34. }
  35. //*===================>>>File-IO-Functions<<<=================
  36. void fileIO()
  37. {
  38. #ifndef ONLINE_JUDGE
  39. freopen("in.txt", "r", stdin);
  40. freopen("out.txt", "w", stdout);
  41. #endif
  42. }
  43. //*===================>>>ONE-FOR-ALL-Function<<<==============
  44. void OneForAll()
  45. {
  46. ll num;
  47. cin >> num;
  48.  
  49. bool isPrime = true;
  50. if (num < 2)
  51. isPrime = false;
  52. for (ll i = 2; i * i <= num; i++)
  53. {
  54. if (num % i == 0)
  55. {
  56. isPrime = false;
  57. break;
  58. }
  59. }
  60. cout << (isPrime ? "YES" : "NO") << endl;
  61. }
  62.  
  63. int main()
  64. {
  65. fastIO();
  66. fileIO();
  67.  
  68. ll tc = 1;
  69. // cin >> tc;
  70. while (tc--)
  71. {
  72. OneForAll();
  73. }
  74. time;
  75. return 0;
  76. }
  77.  
Success #stdin #stdout #stderr 0.01s 5316KB
stdin
Standard input is empty
stdout
NO
stderr
Time Taken: 0.006084 Secs