当前位置:网站首页>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
边栏推荐
- [js]var, let, const
- 在线JSON转PlainText工具
- This kind of people began to be robbed by VC with a monthly salary of 80000 yuan
- 陈云pytorch学习笔记_用50行代码搭建ResNet
- Senior headhunting team manager: interviewed 3000 consultants, summarized and organized 8 commonalities (Mao Sheng)
- seata
- Spark bug practice (including bug:classcastexception; connectexception; NoClassDefFoundError; runtimeException, etc.)
- Is it safe to use flush mobile phones to speculate in stocks?
- What problems should be paid attention to in the serpentine wiring of PCB?
- 【剑指Offer】48. 最长不含重复字符的子字符串
猜你喜欢

Small chip chiplet Technology

Excel print settings public header

Working at home is more tiring than going to work at the company?

C WinForm reads the resources picture

【PCL自学:Segmentation4】基于Min-Cut点云分割

webService
思源笔记订阅停止直接删云端数据嘛?

Netease cloud lost its "feelings" card

C# Winform 读取Resources图片
![[Blue Bridge Cup training 100 questions] scratch digital calculation Blue Bridge Cup competition special prediction programming question collective training simulation exercise question No. 16](/img/7c/d4ea8747ce45fd2eb59a8f968653db.png)
[Blue Bridge Cup training 100 questions] scratch digital calculation Blue Bridge Cup competition special prediction programming question collective training simulation exercise question No. 16
随机推荐
【PCL自学:PCLPlotter】PCLPlotter绘制数据分析图
【剑指Offer】47. 礼物的最大价值
mysql 字符集
沉寂了一段时间 ,我又出来啦~
seata
【蓝桥杯集训100题】scratch数字计算 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第16题
如何找到外文文献对应的中文文献?
Google Earth engine (GEE) 03 vector data type
Advertising is too "wild", Yoshino "surrenders"
使用cef3开发的浏览器不支持flash问题的解决
【AI应用】NVIDIA Tesla V100S-PCIE-32GB的详情参数
What problems should be paid attention to in the serpentine wiring of PCB?
文献综述如何挑选文献进行阅读,比如我的检索结果有200多篇根本看不完,如何进行文献挑选呢?...
云辅助隐私集合求交(Server-Aided PSI)协议介绍:学习
获取基因有效长度的N种方法
Sentinel
Online JSON to plaintext tool
seata
ICML 2022: UFRGS |作为最优策略转移基础的乐观线性支持和后继特征
matlab axis坐标轴相关设置详解