fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, x;
  6.  
  7. cin >> n;
  8.  
  9.  
  10.  
  11. for (int i = 1; i <= n; i++)
  12.  
  13. {
  14. if (n >= 100000)
  15. break;
  16.  
  17. start:
  18. cin >> x;
  19.  
  20. if (x < 1 || x>10000)
  21. break;
  22. if (x < 2)
  23. cout << "NIE" << endl;
  24. else if (x == 2)
  25. cout << "TAK" << endl;
  26. else
  27. {
  28. for (i = 2; i < x; i++)
  29. {
  30.  
  31. if (x%i == 0)
  32. {
  33. cout << "NIE" << endl;
  34. goto start;
  35. break;
  36. }
  37. }
  38.  
  39. for (i = 2; i < x; i++)
  40. {
  41. if (x%i != 0)
  42. {
  43. cout << "TAK" << endl;
  44. break;
  45.  
  46. }
  47. }
  48.  
  49.  
  50. }
  51. }
  52.  
  53.  
  54.  
  55. return 0;
  56. }
Success #stdin #stdout 0s 4912KB
stdin
Standard input is empty
stdout
Standard output is empty