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