PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000210. Tích của mọi ước (Multipliers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tích của mọi ước (Multipliers)
Tích của mọi ước (Multipliers)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is given as a multiset of primes , so . Find the product of all distinct positive divisors of modulo , without constructing .
Input
The first line contains ; the second line contains primes , possibly repeated.
Output
Print one integer in the range to .
Subtasks
-
Subtask 1 (20 points): ; mỗi là số nguyên tố, .
-
Subtask 2 (30 points): ; mỗi là số nguyên tố, .
-
Subtask 3 (50 points): ; mỗi là số nguyên tố, .
Examples
Example 1
Input
2
2 3
Output
36
Explanation
6 has divisors 1,2,3,6; their product is 36.
Example 2
Input
3
2 3 2
Output
1728
Explanation
12 has divisors 1,2,3,4,6,12 whose product is 1728.
Example 3
Input
1
2
Output
2
Explanation
2 has divisors 1 and 2; their product is 2.