PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000079. Đếm số có đúng k ước nguyên tố phân biệt (Bedao Regular Contest 03 - PRIME)
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ố có đúng k ước nguyên tố phân biệt (Bedao Regular Contest 03 - PRIME)
Bedao Regular Contest 03 - PRIME
Source: VNOJ
Version: Phuoc Hung OJ Extended
Problem Statement
You are given range queries . For each query, count the integers with that have exactly distinct prime divisors. For instance, has two distinct prime divisors, while has one.
Input
The first line contains the number of queries . Each of the next lines contains three integers in that order.
Output
Print lines, one answer for each query, in the original order.
Subtasks
- Subtask 1 (40 points): ; ; for every query .
- Subtask 2 (60 points): ; ; for every query .
Examples
Input
2
3 6 2
7 10 1
Output
1
3
Explanation
In , only has two distinct prime divisors, so the first answer is . In , , , and have exactly one distinct prime divisor, whereas has two. The second answer is .