fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int n, x, c;
  4. int main()
  5. {
  6. cin>>n ;
  7. for (int i=1; i<=n; i++)
  8. {
  9. cin>>x;
  10. if (x<2)
  11. cout << "NIE"<< endl;
  12. if (x==2)
  13. {cout<<"TAK"<< endl;}
  14.  
  15.  
  16. for (int j=2; j<x; j++ )
  17. {
  18. c=x%j ;
  19. if (c==0)
  20. {
  21. cout << "NIE"<< endl;
  22. break;
  23.  
  24. }
  25. }
  26. if (c!=0)
  27. cout << "TAK" << endl;
  28. }
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 2744KB
stdin
15 0 1 2 7 9 37 73 89 101 371 573 891
791 957 55437
stdout
NIE
NIE
TAK
TAK
NIE
TAK
TAK
TAK
TAK
NIE
NIE
NIE
NIE
NIE
NIE