fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool primaryt(int a)
  6. {
  7. if (a<2)
  8. {
  9. return false;
  10. }
  11. for (int i=2; i < a; i++)
  12. {
  13. if (a%i==0)
  14. {
  15. return false;
  16. }
  17. }
  18. return true;
  19. }
  20. int main()
  21. {
  22. int n, i;
  23. int x[10000];
  24. cin >> n;
  25.  
  26. for (i=1; i<=n; i++)
  27. {
  28. cin >> x[i];
  29. }
  30. for (int j=1; j<=n; j++)
  31. {
  32. if (primaryt(x[j]))
  33. {
  34. cout << "TAK"<< endl;
  35. }
  36. else (cout << "NIE" << endl);
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0s 5480KB
stdin
3
11
1
4
stdout
TAK
NIE
NIE