PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000049. Đếm số nguyên tố (Prime Number)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm số nguyên tố (Prime Number)
Prime Number
Source: Aizu Online Judge
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , count the prime numbers not greater than . By definition, is not prime.
Input
One line containing the integer .
Output
Print one integer: the number of prime integers from through .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
10
Output
4
Explanation
The primes in are , exactly four numbers, so the answer is 4.