Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
470 B
0
Indexable
Never
//Bai 3
#include <iostream>
#include <cmath>

using namespace std;

int nt(int n){
	for(int i = 2; i <= sqrt(n); i++){
		if(n%i == 0) return 0;
	}
	return n > 1;
}
int rev(int n){
	int tmp = 0;
	while(n){
		tmp = tmp*10 + n%10;
		n /= 10;
	}
	return tmp;
}

int main(){
	freopen("CPRIME.inp","r",stdin);
	freopen("CPRIME.out","w",stdout);

	int n; cin >> n;
	if(nt(n) && nt(rev(n))) cout << 1 << endl;
	else cout << 0 << endl;

	return 0;
}
Leave a Comment