fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. bool czy_pierwsza (int n)
  5. {
  6. if(n<2)
  7. return false ;
  8. for(int i=2 ; i*i<=n ; i++)
  9. if (n%i==0)
  10. return false ;
  11. else return true ;
  12. }
  13. int main()
  14. {
  15. int n,m;
  16. cin>>m;
  17. for (int i = 0; i<m; i++)
  18. {
  19. cin>> n ;
  20.  
  21. if (czy_pierwsza(n))
  22. cout<< "TAK" << endl ;
  23. else
  24. cout << "NIE "<<endl ;
  25.  
  26.  
  27. }
  28.  
  29. return 0;
  30. }
  31.  
  32.  
Success #stdin #stdout 0s 15240KB
stdin
1
9
stdout
TAK