pat1015Reversible Primes (20)

ENVI5.6 批量处理GF-2/GF-6/GF-7:从安装到融合的完整自动化流程 本文详细介绍了ENVI5.6环境下批量处理GF-2/GF-6/GF-7卫星数据的完整自动化流程,包括环境配置、工具安装、正射校正、图像融合等关键步骤。通过实战案例和优化技巧,帮助用户高效完成高分卫星影像处理,提升工作效率。特别针对GF-6和GF-7的特殊处理要点进行了深入解析。 阅读详情

题意分析:

(1)给定任意一个进制系统下的整数,判断这个数以及它的各位反过来的数在这个进制系统下是否都是素数。

可能坑点:

关于素数的判定有几点需要注意:

(1)在寻找约数的时候,遍历的边界要设置到这个数的开方并取整后的整数(证明:一个数的约数总是在这个数的开方数的左右两侧成对出现,如果左边包括开方数不存在约数,右边一定不存在)

(2)由于浮点数的运算可能存在误差,因此在开方运算后为了保险需要加一个修正floor(sqrt(N)+0.5)

(3)不建议循环内的循环条件设置为i*i<=N,因为在某些int类型的数在很大的情况下相乘可能会导致结果溢出,变成了负数。

#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int N)
{
    if(N==1)return false;
    int sqrtNum=floor(sqrt(N)+0.5);
    for(int i=2;i<=sqrtNum;i++)
    {
        if(N%i==0)return false;
    }
    return true;
}
int getReverseNum(int N,int D)
{
    int result=0;
    while(N/D!=0)
    {
        result=result*D+N%D;
        N=N/D;
    }
    result=result*D+N%D;
    return result;
}
int main()
{
    int N,D;
    while(true)
    {
        cin>>N;
        if(N<0)break;
        cin>>D;
        if(isPrime(N)&&isPrime(getReverseNum(N,D)))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


32、生物医学中的多模态拉曼散射成像技术 本文综述了多模态拉曼散射成像技术在生物医学领域的应用,重点探讨其在肿瘤研究、癌症无创诊断和组织功能分析中的前沿进展。通过结合自发拉曼、相干拉曼散射(CARS/SRS)、光学相干断层扫描(OCT)、荧光寿命成像(FLIM)及多光子显微技术(TPEF/SHG)等多种模态,实现了对细胞和组织的高特异性生化信息与高分辨率形态学特征的同步获取。文章还介绍了多模态SERS纳米探针的设计及其在靶向成像与治疗一体化中的潜力,并系统分析了不同成像方式的操作流程、优势互补性及临床应用场景。最后展望了该技术向小型化、智能化和个性 阅读详情

相关推荐

MATLAB 论文复现——含氢综合能源系统多目标最优折中分布鲁棒低碳调度

提出基于多目标决策理论和逼近理想解排序技术,构造综合考虑系统调度的经济性、低碳性和鲁棒度的多目标最优折中函数,从而建立含氢综合能源系统多目标最优折中分布鲁棒低碳调度模型,可快速准确地获得兼具经济性、低碳性和鲁棒性的含氢综合能源系统优化调度方案。[1]孙惠娟,胡紫平,彭春华,等.含氢综合能源系统多目标最优折中分布鲁棒低碳调度[J/OL].电力自动化设备,1-13[2024-07-26].https://doi.org/10.16081/j.epae.202406003.关键词: 综合能源系统;

sjr1478的博客 410

【PAT(甲级)】1015 Reversible Primes

【PAT(甲级)】1015 Reversible Primes 思路分享,易错点分析

weixin_55202895的博客 325

深入解析π型滤波电路:RC与LC滤波器的实战选型指南

本文深入解析了π型滤波电路的工作原理与实战选型。重点对比了RC型与LC型滤波器的核心差异:RC型成本低、体积小,但存在压降与能耗,适用于小电流场景;LC型效率高、滤波性能好,但成本与体积较大,适合中到大电流及高纹波抑制需求。文章提供了基于不同应用场景的选型指南与设计要点,帮助工程师做出精准决策。

weixin_29291069的博客 655

1015 Reversible Primes(超详细注解,41行代码)

1015 Reversible Primes(超详细注解,41行代码)

m0_66329385的博客 161

STC32G电调调试血泪史:从TPH1R403NL MOS管烧毁到PWM信号异常排查全记录

本文详细记录了STC32G无刷电调调试过程中的常见问题与解决方案,包括MOS管烧毁、PWM信号异常等关键故障排查。通过电源系统检测、驱动电路验证及三相平衡调试等实战经验,帮助硬件爱好者快速定位问题,提升电调调试效率。特别针对TPH1R403NL等MOS管的保护措施进行了重点分析。

weixin_33736048的博客 551

从零开始:用RFSOC XCZU47DR搭建软件无线电开发环境(2023最新版)

本文详细介绍了如何使用Xilinx RFSoC XCZU47DR搭建高性能软件无线电(SDR)开发环境,涵盖硬件选型、开发环境配置、射频子系统校准及实战应用开发。特别针对2023年最新技术需求,提供从基础配置到高级优化的完整指南,助力科研人员和工程师快速掌握RFSoC开发技术。

weixin_42525005的博客 512

甲级PAT 1015 Reversible Primes(大量素数经典方法+二分查找)

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 pr...

Joyceyang_999的博客 340

超越音频!STM32 SAI接口在AD7768高速ADC采集中的妙用(含PCB布局指南)

本文深入探讨了如何将STM32的SAI接口应用于AD7768高速ADC的数据采集系统,超越了其传统的音频应用范畴。文章详细解析了SAI协议与ADC时序的匹配方法,提供了从CubeMX配置、DMA数据搬运到关键PCB布局指南的完整实战方案,旨在帮助工程师实现稳定、高精度的工业级高速数据采集。

efc12345678的博客 304

1015 Reversible Primes (20 分) PAT 甲级 一定要读懂题意

1015 Reversible Primes (20 分) 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 beca...

小渣渣的博客 276

Image Sensor常见分辨率下HTS,VTS设置

image sensor,HTS,VTS

propor的专栏 4974

搞定ESD(九):静电放电之PCB设计

不同信号参考地平面应尽量保持完整,减小静电电流流过参考地平面时造成的电位差,防止电位差导致的信号传输电平错误.主芯片GPIO信号布线应保持最短化,减小与参考地平面之间的电场耦合,同时也防止因信号环路面积较大耦合静电放电噪声干扰。外部端子接地引脚顶层采用分地设计,最好是直接过孔到完整参考地平面接地,避免与顶层信号包地、其它包地相连,防止顶层串扰耦合到其它信号,造成ESD问题。

记得诚 1951

1015 Reversible Primes(质数)

1015 Reversible Primes

老顽固也可爱 427

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

PAT甲级 1015 Reversible Primes (20分)

PAT甲级 1015 Reversible Primes (20分) 做好本题的首要是读懂题意,然后就是注意坑点,本题最后一个测试点即为坑点,因为int型最大的数转成2进制或者1进制肯定是会超越int的表示范围,故答案出错误。其余3个点为常规测试点。 附本人暴力代码,讲真不建议刷PAT直接对照着别人的代码敲一遍,那样提升会很小,自己实在做不出来再参考别人的,本人这题做了挺长时间的,但是还是自己AC了。100行左右的代码! #include <iostream> #include <cstd

一棵小白菜的博客 405

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

PAT 1015. Reversible Primes (20)

题目:1015. Reversible Primes (20) 思路:1.由于N             2.以N 注意:             在本次题目中,我选择使用质数表,但并未给0,1 标注为不是质数,导致测试点2通不过,即忽略了 reversible number 等于1的情况(如输入2,2 ,则reversible number为1)。 代码: #include usin

changeforeve的博客 378

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

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

1015 Reversible Primes 题目描述 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...

初见还是重逢的博客 413

PAT甲级 - 1015 Reversible Primes (20 分)

题目链接:PAT甲级 - 1015 Reversible Primes (20 分) 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 reversib...

213

[PAT] 1015 Reversible Primes (20 分)Java

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...

Simma1101的博客 237

PAT-1015 Reversible Primes (20)

题目大意:每组测试中给出一个十进制数 N 和进制 D,求 N 化为 D 进制的逆序是否为质数和 N 是否是质数。解题思路:简单题。题目链接:https://www.patest.cn/contests/pat-a-practise/1015#include &lt;iostream&gt; #include &lt;algorithm&gt; #include &l...

zhoujian_1943的博客 240

pat 1015 Reversible Primes(20 分)

1015 Reversible Primes(20 分) 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 ...

dggnqzt6462的博客 124

PAT甲级-1015 Reversible Primes (20分)

点击链接PAT甲级-AC全解汇总 题目: 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 re...

卷子的博客 398

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

解题过程的小记录,如有错误欢迎指出。 难度:三星(求素数的模板+进制转换模板) 小导航~题目分析我的解题过程思路bug代码dalao的代码借鉴点 题目分析 给出一个十进制下的数和另外一个进制,如果这个十进制下的数是素数,当它用另外一个进制进行转换后反转然后再次转化为十进制依旧是素数的话,则输出Yes,反之输出No 我的解题过程 思路 写一个判断是否是素数的函数,为了节省时间用sqrt 首先判断初始给出的十进制数是否是素数,如果不是就没有必要进行后续的步骤 将十进制数按给定的进制求余,并且同时将原结果*进制

SpicyChicken的自我修养 206

PAT:A1015 Reversible Primes (20 分)

PAT:A1015 Reversible Primes (20 分) 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...

Ecloss 342

1015. Reversible Primes (20)-PAT

1015. Reversible Primes (20) 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 b

兵临城下 1236

PAT甲级1015. Reversible Primes (20)

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 pri

liaotl10的博客 374
上一篇: pat1014Waiting in Line (30)
下一篇: pat1016Phone Bills (25)
LostStephon
博客等级 码龄11年 14粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值