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