Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <iostream>
- using namespace std;
- bool prim ( int n)
- {
- if ( n<2 ) return 0;
- if ( n==2 ) return 1;
- if ( n%2== 0 ) return 0;
- for( int i=3; i*i<=n; i+=2)
- if (n % i == 0) return 0;
- return 1;
- }
- int main ()
- {
- int a;
- cin >> a;
- bool k = false;
- for( int i = 2; i*i <= a; i++)
- {
- if ( a % i == 0 && prim(i) == true )
- {
- if ( prim ( a / i ) == true && i*i != a )
- k = true;
- break;
- }
- if ( i >= 3 )
- i++;
- }
- if( k == true )
- cout << "DA";
- else
- cout << "NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement