fork(1) download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int i, dzielnik, liczba,j;
  9. int pierw;
  10. int spr = 1;
  11. cin >> j;
  12. if (j > 100000)
  13. {
  14. return 0;
  15. }
  16.  
  17. for (int k=0; k < j; k++)
  18. {
  19.  
  20.  
  21. cin >> liczba;
  22. if (liczba > 10000 || liczba == 1)
  23. {
  24. return 0;
  25. }
  26. pierw = sqrt(liczba);
  27.  
  28. for (i = 2; i <= pierw; i++)
  29. {
  30. dzielnik = liczba % i;
  31. spr = spr*dzielnik;
  32.  
  33. }
  34.  
  35. if (spr == 0)
  36. {
  37. cout << "NIE";
  38.  
  39. }
  40. if (spr != 0 || liczba == 2)
  41. {
  42. cout << "TAK";
  43. }
  44. spr = 1;
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. return 0;
  52.  
  53. }
Success #stdin #stdout 0s 4548KB
stdin
5
11
2
3
4
1
stdout
TAKTAKTAKNIE