PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000210. Đếm ước giai thừa - trung bình (Divisors of Factorial (medium))
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 ước giai thừa - trung bình (Divisors of Factorial (medium))
Divisors of Factorial (medium)
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given two integers and , find the number of positive divisors of , modulo .
The modulus is not guaranteed to be prime; the computation must also work for composite moduli. For example, has eight divisors and . Since can approach , the factorial cannot be represented explicitly.
Input
The only line contains the integers .
Output
Print an integer in : the number of positive divisors of modulo .
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
4 5
Output
3
Explanation
has divisors. Since , the required remainder is . No modular division is needed, so a composite modulus is permitted.