sicily-1561. PRIME
来源:互联网 发布:jpg转换成pdf mac 编辑:程序博客网 时间:2024/04/30 11:15
1561. PRIME
限制条件
时间限制: 1 秒, 内存限制: 32 兆
题目描述
A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. The first prime number is 2. Can you write a program that computes the nth prime number, given a number n <= 10000?
输入格式
The input contains just one number which is the number n as described above.
The maximum value of n is 10000.
输出格式
The output consists of a single line with an integer that is the nth prime number.
样例输入
30
样例输出
113
这道题大概意思是求第n个素数是多少,比教简单,我就直接放代码吧
//1561. PRIME//2016.11.22#include <iostream>using namespace std;long long p[10001]={2,};bool isprime(long long m) // 判断 素数 {for(long long i=2;i*i<=m;i++) {if(m%i==0)return false;}return true;}int main(){long long n;cin>>n;long long i=0,m=2; //i计算素数的个数 while(i<=n){if(isprime(m))p[i++]=m;m++;}cout<<p[n-1]<<endl;return 0;}
0 0
- sicily--1561. PRIME
- sicily 1561.PRIME
- Sicily 1561. PRIME
- [sicily]1561. PRIME
- Sicily 1561. PRIME
- sicily-1561. PRIME
- sicily 1444. Prime Path
- Sicily 1444 Prime Path
- Sicily 4190. Prime Palindromes
- Sicily 4481. Prime Factorization
- sicily--1500. Prime Gap
- sicily 4190 Prime Palindromes
- sicily 4190 Prime Palindromes
- Sicily 1500. Prime Gap
- sicily 1500.Prime Gap
- Sicily 1500. Prime Gap
- Sicily 4190Prime Palindromes
- Sicily 1444. Prime Path
- zstu KI的斐波那契
- iShare·AD小技巧--在AD中如何快速的切换版层
- 【算法】常见的七种排序及其算法优化
- Java泛型(Generic)理解之一:T和?的区别
- sheral——一个方便定制及扩展的UI组件库
- sicily-1561. PRIME
- maven 标签,仓库修改
- 123
- thinkphp框架中的c方法
- Android沉浸式状态栏
- linux下ifconfig、iwconfig、iwlist命令详解
- 为eclipse安装marketplace
- 有效的职业规划设计是什么?
- LeetCode 374. Guess Number Higher or Lower