#include <iostream> using namespace std; int main() { long long n; cin>>n; //for(int j=1;j<200;++j){ long long i=2; long long ldzi=0; //n=j; while((n!=1&&i*i<=n)&&ldzi<3) { if(n%i==0) { ldzi++; while(n%i==0) n/=i; } ++i; } //cout<<j<<": " //cout<<ldzi<<"\n"; //} if(ldzi==1&&n>1) cout<<"TAK\n"; else cout<<"NIE\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <iostream> using namespace std; int main() { long long n; cin>>n; //for(int j=1;j<200;++j){ long long i=2; long long ldzi=0; //n=j; while((n!=1&&i*i<=n)&&ldzi<3) { if(n%i==0) { ldzi++; while(n%i==0) n/=i; } ++i; } //cout<<j<<": " //cout<<ldzi<<"\n"; //} if(ldzi==1&&n>1) cout<<"TAK\n"; else cout<<"NIE\n"; } |