首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
Prime Number
[编程题]Prime Number
热度指数:17301
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
算法知识视频讲解
Output the k-th prime number.
输入描述:
k≤10000
输出描述:
The k-th prime number.
示例1
输入
3 7
输出
5 17
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(7)
邀请回答
收藏(84)
分享
提交结果有问题?
89个回答
30篇题解
开通博客
牛客652687585号
发表于 2022-03-04 20:27:39
#include<iostream> #include<cstdio> #include<vector> using namespace std; const int MAXN=1e5+1e4; bool isPr
展开全文
鱼儿恋上水
发表于 2020-03-31 17:21:05
埃氏筛法: #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int maxn = 10000000; int prime[maxn]; bool
展开全文
MEMESOREREMEREDODOLA
发表于 2020-04-30 11:55:05
/* 方法一:枚举(不需要重复求子问题,稍有优化) #include <cstdio> #include <iostream> #include <vector> #include <algorithm>
展开全文
NiDeHaiWang
发表于 2024-02-28 14:00:47
#include <iostream> using namespace std; int main() { int arr[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
展开全文
Xyzz1223
发表于 2022-05-03 22:23:48
使用一个vector存储已经计算过的素数,根据vector的长度判断当前需要求的素数是否已经计算过,若以及计算过,则直接通过数组的下标取出结果。 #include<cstdio> #include<iostream> #include<cmath> #includ
展开全文
nzxkc
发表于 2022-02-11 23:15:53
素数筛,随便打的表 #include<iostream> using namespace std; const int N = 100010; int primes[N]; bool st[N]; int
展开全文
AuroraYxh
发表于 2023-07-21 15:11:09
#include <bits/stdc++.h> #include <vector> using namespace std; const int N=5e5+10; bool st[N]; vector<int> prime; void get_prim
展开全文
Montage.
发表于 2022-01-21 12:30:59
依次向后判断即可 #include #include #include using namespace std; bool isSu(int n){ int bound = sqrt(n); for(int i=2;i<=bound;i++){ if(n%i==0){ return fa
展开全文
准备笔试的哈士奇很坦荡
发表于 2023-03-20 21:04:34
#include <stdio.h> int main() { int n,a[100007]={0}; int i=0; int j,flag; while (scanf("%d",&n)!=EOF) { //scanf("%d",&n
展开全文
Ooops!
发表于 2023-09-13 18:24:05
#include<bits/stdc++.h> using namespace std; vector<int> dp(110000,1); void zhi(){ for(int i=2;i<110000;i++){ if(dp[i]==
展开全文
问题信息
基础数学
难度:
89条回答
84收藏
6992浏览
热门推荐
通过挑战的用户
查看代码
CITYHUA
2023-03-14 18:32:32
爱吃肉的茶叶蛋在干饭
2023-03-12 22:18:14
yali666
2023-03-11 11:26:05
大牛来了_
2023-03-11 09:34:42
小苕
2023-03-08 09:50:56
相关试题
牛牛的超市
动态规划
基础数学
评论
(5)
线段树编号问题
基础数学
评论
(2)
车站建造问题
基础数学
评论
(40)
进制转换
字符串
评论
(2547)
来自
华为研发工程师编程题
编译方法中,动态存储分配的含义是:()
编译和体系结构
评论
(2)
来自
乐视2017秋招开发工程...
Prime Number
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
3 7
5 17