← ~/試題
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