PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000186. Số ước của hệ số nhị thức (Divisors of Binomial Coefficient)
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ố ước của hệ số nhị thức (Divisors of Binomial Coefficient)
Divisors of Binomial Coefficient
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
For integers satisfying , the binomial coefficient is
Find the number of its distinct positive divisors, modulo . The input can be too large to evaluate the factorials directly.
Input
The input contains two integers and .
Output
Print the number of positive divisors of modulo .
Subtasks
-
Subtask 1 (20 points): , .
-
Subtask 2 (30 points): , .
-
Subtask 3 (50 points): , .
Examples
Example 1
Input
5 2
Output
4
Explanation
The coefficient has four positive divisors: .
Example 2
Input
103 3
Output
8
Explanation
The coefficient has eight positive divisors.
Example 3
Input
1000000000000 1000000
Output
110520107
Explanation
Factoring the binomial coefficient by its numerator interval and denominator gives after reduction modulo .