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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
string liczba;
int main(){
	cin >> liczba;

	
	string l1,l2;
	for(int i=0;i<liczba.length()-1;i++){
		l1="",l2="";
		for(int j=0;j<=i;j++){
			l1+=liczba[j];
		}
		for(int j=i+1;j<liczba.length();j++){
			l2+=liczba[j];
		
		}
	//	cout << l1 << " " << l2 << endl;
		unsigned long long liczba1=0,liczba2=0;
		unsigned long long  temp=1;
		bool wiedzie=0;
		if(l1[0]=='0')continue;
			if(l2[0]=='0')continue;
		for(int j=l1.length()-1;j>=0;j--){
			liczba1+=(l1[j]-48)*temp;
			temp*=10;
		
		}

	//	cout << liczba1 << " ";
		temp=1;
		for(int j=l2.length()-1;j>=0;j--){
			liczba2+=(l2[j]-48)*temp;
			temp*=10;
		
		}
	
		//cout << liczba2 << endl;
		wiedzie=0;
		for(int i=2;i<=sqrt(liczba1);i++){
			if(liczba1%i==0){
				wiedzie=1;break;
			}
		}
		if(wiedzie)continue;
		for(int i=2;i<=sqrt(liczba2);i++){
			if(liczba2%i==0){
				wiedzie=1;break;
			}
		}
		if(wiedzie)continue;
		cout << "TAK";
		return 0;
	}
	cout << "NIE";
}