fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int t,a,licznik;
  9. int *wsk=&licznik;
  10. cin>>t;
  11. while(t)
  12. {
  13. *wsk=0;
  14. cin>>a;
  15. if (a==1) goto etykieta;
  16. for (int i=1; i<=sqrt(a); i++ )
  17. {
  18. if (a%i==0) (*wsk)++;
  19. }
  20. etykieta:
  21. if (*wsk>=2 || a==1) cout<<"NIE"<<endl;
  22. else cout<<"TAK"<<endl;
  23. t--;
  24. }
  25. }
  26.  
Success #stdin #stdout 0s 3460KB
stdin
5
1
2
3
4
5
stdout
NIE
TAK
TAK
NIE
TAK