← ~/试题
P2007

Count the Primes

Medium
// 描述
Given an integer n, count how many prime numbers are less than or equal to n.
// 输入格式
A single integer n (1 <= n <= 10^6).
// 输出格式
The number of primes not greater than n.
// 提示
A sieve of Eratosthenes counts all primes up to n in O(n log log n).
// 样例
输入样例
10
输出样例
4
// 题目信息
难度Medium
通过率80%
时间限制1000 ms
内存限制65536 KB
通过8