/*runda probna - liczby drugie*/
#include <iostream>
using namespace std;
typedef long long LL;
bool inline IsPrime(LL number)
{
for(LL i=2;i*i<=number;++i)
if((number%i)==0)
return false;
return true;
}
int main()
{
LL first;
cin >> first;
LL second=0;
LL mult=1;
while(first>9)
{
int n = first%10;
first /= 10;
second += n*mult;
mult *= 10;
if(n && IsPrime(first) && IsPrime(second))
{
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 33 34 35 | /*runda probna - liczby drugie*/ #include <iostream> using namespace std; typedef long long LL; bool inline IsPrime(LL number) { for(LL i=2;i*i<=number;++i) if((number%i)==0) return false; return true; } int main() { LL first; cin >> first; LL second=0; LL mult=1; while(first>9) { int n = first%10; first /= 10; second += n*mult; mult *= 10; if(n && IsPrime(first) && IsPrime(second)) { cout << "TAK"; return 0; } } cout << "NIE"; return 0; } |
English