PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000263. Đếm số nguyên không chứa bình phương (Counting Square-free Integers)
HỌC THEO LỘ TRÌNH
2 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm số nguyên không chứa bình phương (Counting Square-free Integers)
Counting Square-free Integers
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is square-free if there is no integer such that divides . Equivalently, each prime occurs at most once in the prime factorization of .
Given a positive integer , count all square-free integers such that . The integer is included.
Input
One line contains the positive integer .
Output
Print a single integer: the number of square-free integers from through , inclusive.
Subtasks
- Subtask 1 (20 points): . Time limit: s.
- Subtask 2 (30 points): . Time limit: s.
- Subtask 3 (50 points): . Time limit: s.
Examples
Input
10
Output
7
Explanation
The square-free integers between and are , so the answer is . The values and are divisible by , while is divisible by .