Advertisement
Alexandre_lsv

Untitled

Feb 22nd, 2016
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. double simpletest(long long a){
  5.     for (int i=2; i<sqrt(a);i++){
  6.         if (!(a%i))
  7.             return false;
  8.     }
  9.     return true;
  10. }
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14.     long long a;
  15.     cin >> a;
  16.     for (int i=2; i<=sqrt(a);i++){
  17.         if (!(a%i)){
  18.             cout << (simpletest(i)&&simpletest(a/i)?"Yes":"No");
  19.             return 0;
  20.         }
  21.     }
  22.     cout << "No"; // if input value -- simple
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement