fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, ilosc=1;
  8. unsigned int l;
  9. cin>>n;
  10. while(n--)
  11. {
  12. poczatek:
  13. cin>>l;
  14. if(l==0)
  15. {
  16. goto poczatek;
  17. n++;
  18. }
  19. for(int i=2; i<=l; i++ )
  20. {
  21. if((l % i==0))
  22. {
  23. ilosc++;
  24. }
  25. if(ilosc>2)
  26. break;
  27. }
  28. if(l==1)
  29. {
  30. cout<<"NIE"<<endl;
  31. }
  32. else if(ilosc!=2)
  33. {
  34. cout<<"NIE"<<endl;
  35. }
  36. else if(ilosc==2)
  37. {
  38. cout<<"TAK"<<endl;
  39.  
  40. }
  41.  
  42. }
  43.  
  44. return 0;
  45. }
Success #stdin #stdout 0.01s 5652KB
stdin
3
0
11
1
4
stdout
TAK
NIE
NIE