PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000177. Số bán nguyên tố H (Semi-prime H-numbers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số bán nguyên tố H (Semi-prime H-numbers)
Semi-prime H-numbers
Phuoc Hung OJ ID: PRIME000182
Source: UVa 11105 (PHOJ Extended, one input instance per run).
Problem statement
An H-number is a positive integer of the form , where . One is the unique unit. An H-number greater than 1 is an H-prime if it cannot be expressed as the product of two H-numbers greater than 1. An H-semiprime can be expressed as the product of two H-primes, possibly equal. Given an H-number , count all H-semiprimes from 1 through , inclusive.
Input
One integer , which is an H-number.
Output
Print h cnt, where cnt is the number of H-semiprimes not exceeding .
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Example
Input
85
Output
85 5
Explanation: There are five H-semiprimes up to 85: 25, 45, 65, 81 and 85.