#include <bits/stdc++.h>
using namespace std;
inline long long strToLL(string str){
stringstream sstr(str);
long long l;
sstr >> l;
return l;
}
inline bool isPrime(long long a){
if(a == 0 || a == 1)
return false;
for(long long i=2;i*i<=a;i++){
if(a % i == 0)
return false;
}
return true;
}
main(){
ios::sync_with_stdio(false);
string str;
cin >> str;
for(int i=0;i<str.size();i++){
string s1 = str.substr(0,i);
string s2 = str.substr(i);
if(s1.size() == 0 || s2.size() == 0 || s1[0] == '0' || s2[0] == '0')
continue;
long long a1 = strToLL(s1);
long long a2 = strToLL(s2);
if(isPrime(a1) && isPrime(a2)){
cout<<"TAK\n";
return 0;
}
}
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 31 32 33 34 35 36 37 38 | #include <bits/stdc++.h> using namespace std; inline long long strToLL(string str){ stringstream sstr(str); long long l; sstr >> l; return l; } inline bool isPrime(long long a){ if(a == 0 || a == 1) return false; for(long long i=2;i*i<=a;i++){ if(a % i == 0) return false; } return true; } main(){ ios::sync_with_stdio(false); string str; cin >> str; for(int i=0;i<str.size();i++){ string s1 = str.substr(0,i); string s2 = str.substr(i); if(s1.size() == 0 || s2.size() == 0 || s1[0] == '0' || s2[0] == '0') continue; long long a1 = strToLL(s1); long long a2 = strToLL(s2); if(isPrime(a1) && isPrime(a2)){ cout<<"TAK\n"; return 0; } } cout<<"NIE\n"; } |
English