#include <iostream>
#include <cmath>
using namespace std;
long long pow_dziesiec[] = {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000};
bool isPrime(long long l)
{
if (l==0 || l==1) return false;
for (int x=2;x<=(long long)sqrt(l);x++)
if (l%x==0) return false;
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
long long n;
cin >> n;
for (int i=1;i<=13;i++)
{
if (n%pow_dziesiec[i]>pow_dziesiec[i-1] && isPrime(n/pow_dziesiec[i]) && isPrime(n%pow_dziesiec[i]))
{
cout << "TAK";
return 0;
}
}
cout << "NIE";
return 0;
}
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 31 32 | #include <iostream> #include <cmath> using namespace std; long long pow_dziesiec[] = {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000}; bool isPrime(long long l) { if (l==0 || l==1) return false; for (int x=2;x<=(long long)sqrt(l);x++) if (l%x==0) return false; return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; for (int i=1;i<=13;i++) { if (n%pow_dziesiec[i]>pow_dziesiec[i-1] && isPrime(n/pow_dziesiec[i]) && isPrime(n%pow_dziesiec[i])) { cout << "TAK"; return 0; } } cout << "NIE"; return 0; } |
English