fork download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. int Pierwsza(int p)
  8. {
  9. int i = 2;
  10. while(i < p) if(!(p % i++)) return false;
  11. return true;
  12. }
  13.  
  14. int n;
  15.  
  16. main(){
  17.  
  18. cin >> n;
  19. int p;
  20.  
  21. for (int i=0; i<n; i++)
  22. {
  23. cin >> p;
  24.  
  25. if (Pierwsza(p)) cout << "TAK" << endl;
  26. else
  27. cout << "NIE" << endl;
  28.  
  29. }
  30.  
  31.  
  32. return 0;
  33.  
  34. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Standard output is empty