#abc233c. C - Product
C - Product
Score : points
问题陈述
我们有 个袋子。
第 个袋子中装有 个球。在第 个袋子里的第 个球()上写有一个正整数 。
我们将从每个袋子中选出一个球。
请问有多少种方式可以挑选这些球,使得所选球上数字的乘积为 ?
注意,即使球上写有相同的数字,我们也区分所有球。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have bags.
Bag contains balls. The -th ball in Bag has a positive integer written on it.
We will pick out one ball from each bag.
How many ways are there to pick the balls so that the product of the numbers written on the picked balls is ?
Here, we distinguish all balls, even with the same numbers written on them.
Constraints
- The product of the numbers of balls in the bags is at most : .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 40
3 1 8 4
2 10 5
Sample Output 1
2
When choosing the -rd ball in Bag and -st ball in Bag , we have .
When choosing the -nd ball in Bag and -nd ball in Bag , we have .
There are no other ways to make the product , so the answer is .
Sample Input 2
3 200
3 10 10 10
3 10 10 10
5 2 2 2 2 2
Sample Output 2
45
Note that we distinguish all balls, even with the same numbers written on them.
Sample Input 3
3 1000000000000000000
2 1000000000 1000000000
2 1000000000 1000000000
2 1000000000 1000000000
Sample Output 3
0
There may be no way to make the product .
update @ 2024/3/10 10:08:40