PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000209. Đếm dãy có tích bằng M (Factorization)
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 dãy có tích bằng M (Factorization)
Đếm dãy có tích bằng M (Factorization)
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers , count the ordered sequences of positive integers with product . Two sequences differing at any position are distinct. Output the count modulo .
Input
One line containing .
Output
Print the number of valid sequences modulo .
Subtasks
-
Subtask 1 (20 points): ; .
-
Subtask 2 (30 points): ; .
-
Subtask 3 (50 points): ; .
Examples
Example 1
Input
2 6
Output
4
Explanation
The sequences are (1,6), (2,3), (3,2), (6,1).
Example 2
Input
3 12
Output
18
Explanation
12=2^2*3. The corresponding stars-and-bars counts are 6 and 3, so the result is 18.
Example 3
Input
1 1
Output
1
Explanation
The sole sequence is (1).