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.  
  17. cin>>z;
  18. if(z<1 || z>100000) return 0;
  19. if(z==1)
  20. {
  21. cout<<"NIE"<<endl;
  22.  
  23. }
  24. if(z==2)
  25. {
  26. cout<<"TAK"<<endl;
  27.  
  28.  
  29. }
  30. for(int i=2;i<z;i++)
  31. {
  32.  
  33. if(z%i==0)
  34. {
  35. cout<<"NIE"<<endl;
  36. break;
  37.  
  38. } else
  39. {
  40. cout<<"TAK"<<endl;
  41. break;
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. }
  50. }
  51. return 0;
  52. }
Success #stdin #stdout 0s 4500KB
stdin
3
11
4
1
stdout
TAK
NIE
NIE