当前位置:网站首页>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
边栏推荐
- 手把手教你移植 tinyriscv 到FPGA上
- 【PCL自学:Segmentation3】基于PCL的点云分割:区域增长分割
- Google Earth engine (GEE) 03 vector data type
- pytorch 入门指南
- 企业架构师面试的100个问题
- c语言-日期格式化[通俗易懂]
- Started a natural language model bloom
- 撰写外文时怎样引用中文文献?
- 小芯片chiplet技术杂谈
- Discuz taobaoke website template / Dean taobaoke shopping style commercial version template
猜你喜欢

The file or assembly 'cefsharp.core.runtime.dll' or one of its dependencies could not be loaded. Is not a valid Win32 Application. (exception from hresult:0x800700c1)

vivado VIO IP的用法

Usage of vivado vio IP

Excel print settings public header

陈云pytorch学习笔记_用50行代码搭建ResNet

Feign implements path escape through custom annotations

发射,接收天线方向图

This year's examinees are more "desperate" than the college entrance examination

PE buys a underwear company

量化交易入门教程
随机推荐
golang - new和make的区别
webService
MySQL十八:写语句的执行过程
Small chip chiplet Technology
Discuz small fish game wind shadow legend business gbk+utf8 version template /dz game website template
【Vim】使用教程,常用命令,高效使用Vim编辑器
撰写外文时怎样引用中文文献?
The most illusory richest man in China is even more illusory
[learn FPGA programming from scratch -48]: Vision - development and application of intelligent sensors
halcon之区域:多种区域(Region)特征(6)
新加坡国立大学|采用无模型强化学习方法评估能源效益数据中心的节能情况
本机部署一个MongoDB单节点服务器,并启用auth验证、开启oplog
Discuz淘宝客网站模板/迪恩淘宝客购物风格商业版模板
Stream + Nacos
Stream + Nacos
Is the dog virtue training with a monthly salary of 30000 a good business?
NDSS 2022 接收的列表
To build a "strong core" in Nansha, the first IC Nansha conference was held in Nansha
Netease cloud lost its "feelings" card
virtualbox扩展动态磁盘大小的坑