题意:ekjfkj=output 依此解开密码,得到题意求第n位(本身是素数,同时反过来也是素数的数)
题解:打表
注意:数组开大,反过来的数不能是自己本身
Description
qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.
Input
jxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≤ d ≤ 11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt.
Output
ekjfkj q iydwbu dkcruh.
Sample Input
Input
1
Output
13
#include<stdio.h> #include<math.h> int a[11185]; int prime(int n) { for(int i=2;i*i<=n;i++) { if(n%i==0) return 0; } return 1; } int mainn(int x) { int sum=0; while(x) { sum=sum*10+x%10; x=x/10; } return sum; } int main() { int i,k=1; for(i=12;i<=999998;i++) { if(prime(i)==1&&prime(mainn(i))==1&&i!=mainn(i)) a[k++]=i; } int n; while(~scanf("%d",&n)) { printf("%d ",a[n]); } return 0; }