A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime.

Now given any two positive integers N (<) and D (1), you are supposed to tell if N is a reversible prime with radix D.

Input Specification:

The input file consists of several test cases. Each case occupies a line which contains two integers N and D. The input is finished by a negative N.

Output Specification:

For each test case, print in one line Yes if N is a reversible prime with radix D, or No if not.

Sample Input:

73 10
23 2
23 10
-2

Sample Output:

Yes
Yes
No

题目分析:对于每个数来说 若它本身是素数 且 它转换为某个进制后的逆转 是素数 则称之为Reversible Prime

1015 Reversible Primes (20 分)的更多相关文章

  1. PAT 甲级 1015 Reversible Primes (20 分) (进制转换和素数判断(错因为忘了=))

    1015 Reversible Primes (20 分)   A reversible prime in any number system is a prime whose "rever ...

  2. PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642 题目描述: A reversible prime in any n ...

  3. PAT 1015 Reversible Primes (20分) 谜一般的题目,不就是个进制转换+素数判断

    题目 A reversible prime in any number system is a prime whose "reverse" in that number syste ...

  4. PAT (Advanced Level) Practice 1015 Reversible Primes (20 分)

    A reversible prime in any number system is a prime whose "reverse" in that number system i ...

  5. 【PAT甲级】1015 Reversible Primes (20 分)

    题意: 每次输入两个正整数N,D直到N是负数停止输入(N<1e5,1<D<=10),如果N是一个素数并且将N转化为D进制后逆转再转化为十进制后依然是个素数的话输出Yes,否则输出No ...

  6. 1015. Reversible Primes (20)

    the problem is from PAT,which website is http://pat.zju.edu.cn/contests/pat-a-practise/1015 this pro ...

  7. 1015 Reversible Primes (20)(20 point(s))

    problem A reversible prime in any number system is a prime whose "reverse" in that number ...

  8. PAT-1015 Reversible Primes (20 分) 进制转换+质数

    A reversible prime in any number system is a prime whose "reverse" in that number system i ...

  9. PAT Advanced 1015 Reversible Primes (20) [素数]

    题目 A reversible prime in any number system is a prime whose "reverse" in that number syste ...

随机推荐

  1. utuntu sever1804显示中文putty可以输入中文

    默认情况下,putty连接ubuntu server以后,哪怕设置的Utf-8的连接,也是无法显示中文的. 应该是ubuntu服务器端,没有字库的问题. 如果在putty显示和输入中文呢,因为配置信息 ...

  2. 基于linux下的NIST数字测试包安装过程

    基于linux下的NIST数字测试包安装过程 1. 首先解决windows文件不能粘贴到Ubuntu的问题 选择利用VMware Tools进行解决 打开虚拟机VMware Workstation,启 ...

  3. [vue/require-v-for-key] Elements in iteration expect to have 'v-bind:key' directives.

    使用VScode开发vue中,v-for在Eslint的规则检查下出现报错:如下Elements in iteration expect to have ‘v-bind:key’ directives ...

  4. (转)协议森林04 地址耗尽危机 (IPv4与IPv6地址)

    协议森林04 地址耗尽危机 (IPv4与IPv6地址) 作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! IP地址是IP协议的重要组 ...

  5. ui自动化chrome文件上传操作

    web自动化,再chrome浏览器中文件上传操作

  6. Core + Vue 后台管理基础框架7——APM

    1.前言 APM,又称应用性能统计,主要用来跟踪请求调用链,每个环节调用耗时,为我们诊断系统性能.定位系统问题提供了极大便利.本系统采用的是Elastic Stack体系中的APM,主要是之前部门搞P ...

  7. Windows10专业版+Microsoft office2016专业增强版免费无毒官方正版装机教程(简)

    win10: 1.官网制作系统盘(具体见官网提示) 2.备份C盘 3.重启,主板调到USB优先(重启后疯狂按F12或del,具体看主板型号) 4.安装(这个看造化) 5.激活 slmgr /ipk N ...

  8. CVE-2018-1000861复现

    1. 漏洞描述 Jenkins使用Stapler框架开发,其允许用户通过URL PATH来调用一次public方法.由于这个过程没有做限制,攻击者可以构造一些特殊的PATH来执行一些敏感的Java方法 ...

  9. CentOS7安装和配置ftp服务

    目录 一.ftp简介 二.安装ftp软件包 1.安装ftp服务器 2.安装ftp客户端 三.配置ftp服务器 1.关闭SELINUX 2.配置ftp数据端口参数 3.开通防火墙 4.启动vsftpd服 ...

  10. Thinkphp绕过宝塔getshell

    可以看到直接被拦了,经测试这里是敏感函数字符拦截,大部分有用的敏感函数都被拦了,这里面被拦的是phpinfo() Emmmm,怎么办呢..... 直接执行代码不行,那么就写入代码吧,用file_put ...