当前位置:网站首页>1015 reversible primes (20 points) prime d-ary
1015 reversible primes (20 points) prime d-ary
2022-07-06 07:27:00 【Python ml】
#include <iostream>
using namespace std;
bool isprime(int a){
if(a==1)return false;
for(int i=2;i*i<=a;i++)
if(a%i==0)return false;
return true;
}
int main() {
int n,d;
while (scanf("%d",&n)!=EOF){
if(n<0)break;
scanf("%d",&d);
if(isprime(n)==false){
printf("No\n");
continue;
}
int len=0,arr[100];
do{
// Convert to d Base number
arr[len++]=n%d;
n=n/d;
}while(n>0);
for(int i=0;i<len;i++) // Calculation d The corresponding 10 Whether the hexadecimal number is a prime number
n=n*d+arr[i];
printf("%s\n", isprime(n) ? "Yes" : "No");
}
return 0;
}
边栏推荐
- 1091: two or three things in childhood (multi instance test)
- Emo diary 1
- [CF Gym101196-I] Waif Until Dark 网络最大流
- Summary of Digital IC design written examination questions (I)
- How are the open source Netease cloud music API projects implemented?
- 杰理之BLE【篇】
- Google可能在春节后回归中国市场。
- Yield method of tread
- Relevant introduction of clip image
- Sharing of source code anti disclosure scheme under burning scenario
猜你喜欢

JDBC学习笔记

First knowledge of OpenGL es learning (1)
![[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps](/img/57/ee979a7db983ad56f0df7345dbc91f.jpg)
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps

mysql如何合并数据

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

jmeter性能测试步骤实战教程

JDBC learning notes

navicat如何导入MySQL脚本

The way to learn go (I) the basic introduction of go to the first HelloWorld

Oracle database 11gr2 uses TDE transparent data encryption to report an error ora28353. If you run to close the wallet, you will report an error ora28365. If you run to open the wallet, you will repor
随机推荐
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
After the hot update of uniapp, "mismatched versions may cause application exceptions" causes and Solutions
Select all the lines with a symbol in word and change them to titles
LeetCode Algorithm 2181. Merge nodes between zero
OpenJudge NOI 2.1 1749:数字方格
Lesson 12 study notes 2022.02.11
C语言 简单易懂的高精度加法
杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
TS 类型体操 之 循环中的键值判断,as 关键字使用
Typescript interface and the use of generics
Oracle column to row -- a field is converted to multiple rows according to the specified separator
MVVM of WPF
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Crawling exercise: Notice of crawling Henan Agricultural University
Typescript function definition
Redis builds clusters
(4) Web security | penetration testing | network security web site source code and related analysis
Bloom taxonomy
TypeScript 接口属性
Three treasures of leeks and Chinese men's football team