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