PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000174. Số nguyên tố và phép nhân (Primes and Multiplication)
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ố nguyên tố và phép nhân (Primes and Multiplication)
Primes and Multiplication
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , let be the set of its distinct prime divisors. For a prime , define as the largest power of that divides ; it equals if does not divide .
Define
For example, and .
Given and , calculate
and print modulo .
Input
One line containing two integers and .
Output
Print .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
10 2
Output
2
Explanation
. Here and , so the product is .
Example 2
Input
20190929 1605
Output
363165664
Explanation
. Their exponents in are , and . Thus the result is congruent to , whose remainder modulo is .