Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

There are two friends Ranbir and Alia. Ranbir gave a question to Alia that you are given ‘Q’ queries in the form [N, P].

For each query, Alia has to count how many arrays consisting of positive integers of size ‘N’ she could build such that the product of all the array elements is equal to ‘P’.

Since the answer could be large, return the answer to each query modulo 10^9 + 7.

Detailed explanation

```
1 <= T <= 10
1 <= Q <= 10^4
1 <= N , P <= 10^4
Time Limit: 1 sec
```

```
2
2
2 6
1 1
1
5 1
```

```
4 1
1
```

```
For the first test case, consider each query independently
For the first query where we have to build an array of size 2 and the product of array, elements should be equal to 6. So all the possible arrays are: {1, 6}, {6, 1}, {2, 3} and {3, 2}. Therefore, the answer will be 4 for the given query.
For the second query where we have to build an array of size 1 and the product of the array, elements should be equal to 1. So the only possible array is {1}. Therefore, the answer will be 1 for the given query.
For the second test case, consider each query independently
For the first query where we have to build an array of size 5 and the product of array elements should be equal to 1. So the only possible array is {1, 1, 1, 1, 1}. Therefore, the answer will be 1 for the given query.
```

```
2
2
7 20
2 2
2
3 6
3 4
```

```
196 2
9 6
```