PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000159. Các số vui vẻ (Joyful 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
Các số vui vẻ (Joyful Numbers)
Joyful Numbers
Source: Codeforces Gym 103098J
Version: Phuoc Hung OJ Extended (one dataset per execution; batched queries remain together).
Problem Statement
A positive integer is joyful if appending the digits 25 to the right of gives a perfect square. For example, is joyful because . Given , count the distinct prime factors of the -th joyful number in increasing order.
Input
One integer .
Output
Print the number of distinct prime factors.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Sample Input
4
Sample Output
2
Sample Explanation
The fourth joyful integer equals , so it has two distinct prime factors.