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