当前位置:网站首页>PAT乙级1013
PAT乙级1013
2022-06-27 21:07:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
实现
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int num)
{
int i;
for (i = 2; i <= sqrt(num); i++)
{
if (num%i == 0)
return false;
}
return true;
}
int main(int argc, char* argv[])
{
int count=1,num=2;
int PM,PN,n,m,hang=1;
cin>>PN>>PM;
n=PN;m=PM;
while(count<=m)
{
if(isPrime(num))
{
//cout<<num<<" ";
if(count>=PN)
{
if(hang%10==0)
{
if(count!=PM)
cout<<num<<endl;
else
cout<<num;
}
else
{
if(count==m)
cout<<num;
else
cout<<num<<" ";
}
hang++;
}
count++;
}
//PN--;
num++;
}
//cout<<isPrime(4);
return 0;
}发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/133170.html原文链接:https://javaforall.cn
边栏推荐
猜你喜欢
随机推荐
[electron] 基础学习
Discuz small fish game wind shadow legend business gbk+utf8 version template /dz game website template
通过 MQTT 检测对象和传输图像
webService
使用cef3开发的浏览器不支持flash问题的解决
Structure de stockage des graphiques
Technical implementation process of easycvr platform routing log function [code attached]
Typora 1.2.5等版本下载
使用SQL进行数据去重的N种方法
发射,接收天线方向图
电子科大(申恒涛团队)&京东AI(梅涛团队)提出用于视频问答的结构化双流注意网络,性能SOTA!优于基于双视频表示的方法!
Aggregation and index optimization of mongodb basic operations
获取基因有效长度的N种方法
打造南沙“强芯”,南沙首届IC Nansha大会召开
Course strategy sharing plan of Zhejiang University
Sentinel
How to start ID from 1 after MySQL deletes a table
捷码赋能案例:湖南天辰产研实力迅速提升!实战玩转智慧楼宇/工地等项目
【Vim】使用教程,常用命令,高效使用Vim编辑器
Usage of vivado vio IP









