2832: 第n小的质数 摘要:解题思路:利用f函数得到质数返回给i,并分别按从小到大放到数组中(规模10000)。数组【0】为第1小的质数,所以输出数组[n-1]即是第n小的质数。判断是不是质数函数,如果 为1或0,函数返回假,如…… 题解列表 2022年10月10日 0 点赞 0 评论 475 浏览 评分:8.0
第n小的质数(简单易懂) 摘要:解题思路:求最小质数,实际上也就是最小素数。题目中要求第n个最小质数,利用数组从小到大存放即可;其中的k<=n,表示已经找到第n个最小质数,用来作为判断条件退出for循环注意事项:一般写法会时间超限,…… 题解列表 2023年03月30日 2 点赞 1 评论 890 浏览 评分:4.2
优化求解---第n小的质数 摘要:注意事项:优化求解过程。优化1:第二层for循环中的sqrt(i),因数都是成对出现的。比如,100的因数有:1和100,2和50,4和25,5和20,10和10。看出来没有?成对的因数,其中一个必然…… 题解列表 2022年11月27日 0 点赞 0 评论 396 浏览 评分:0.0
2023-3仅供自己回忆使用 摘要:#include<stdio.h>#include<math.h>int main(){ int i=2,n=2,Num=0,control=0; int th; scanf("%d…… 题解列表 2023年03月01日 0 点赞 0 评论 364 浏览 评分:0.0
2025/8/7刷题记录 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n; scanf("%d&qu…… 题解列表 2025年08月07日 0 点赞 0 评论 151 浏览 评分:0.0
判断一个数是否为质数 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<math.h>//判断一个数是否为质数int&…… 题解列表 2025年02月18日 0 点赞 0 评论 336 浏览 评分:0.0
2832: 第n小的质数 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<math.h>int main(){ int n,j,i,k=0; scanf("%d",&n); …… 题解列表 2024年11月07日 0 点赞 0 评论 344 浏览 评分:0.0
第n小的质数 摘要:解题思路:注意事项:参考代码:import mathn = int(input())flag = Truet = 0for i in range(2,100000): flag = True …… 题解列表 2024年07月31日 0 点赞 0 评论 324 浏览 评分:0.0
编写题解 2832: 第n小的质数 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;bool zs(int n){ for(int i=2;i<n/2+1;i++) {…… 题解列表 2024年05月30日 0 点赞 0 评论 296 浏览 评分:0.0
2832: 第n小的质数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int n,sum=0; cin>>n; …… 题解列表 2024年04月16日 0 点赞 0 评论 267 浏览 评分:0.0