-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00022.cpp
More file actions
42 lines (38 loc) · 769 Bytes
/
00022.cpp
File metadata and controls
42 lines (38 loc) · 769 Bytes
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
// Problem: Eolymp 22 - Mirror Prime Numbers
// Link: https://basecamp.eolymp.com/en/problems/22
#include <bits/stdc++.h>
using namespace std;
bool f(int a){
if(a==1){
return false;
}
for(int i=2;i<=sqrt(a);i++){
if(a%i==0){
return false;
}
}
return true;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a,b;
cin>>a>>b;
int say=0;
for(int j=a;j<=b;j++){
int ters=0;
int i=j;
if(f(i)==true){
while(i>0){
ters=ters*10+i%10;
i=i/10;
}
if(f(ters)==true){
//cout<<ters<<endl;
say++;
}
}
}
cout<<say<<endl;
}