PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000193. Nguyên tố trong tập hợp số hợp (Composite 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
Nguyên tố trong tập hợp số hợp (Composite Prime)
Composite Prime
PHOJ ID: PRIME000198
Original source: UVa 11086
Version: PHOJ Extended, one dataset per run.
Problem statement
Let be the set of composite positive integers. A member is a composite prime if it has no proper divisor also belonging to . Equivalently, it has exactly two prime factors counted with multiplicity: or for primes . Count such elements in a given list.
Input
The first line is ; the next contains positive integers . (PHOJ single-dataset version; value bounds are PHOJ-specific.)
Output
Print the count of qualifying array elements, including repetitions at different positions.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
4
3 4 6 8
Output
2
Explanation
4=2×2 and 6=2×3 are composite primes, 3 is prime, and 8 has composite divisor 4. Thus the answer is 2.