Untitled
unknown
plain_text
7 months ago
466 B
2
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("test.inp","r",stdin); freopen("test.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