Alice has learnt factorization recently. Bob doesn't think she has learnt it properly and hence he has decided to quiz her. Bob gives Alice a very large number and asks her to find out the number of factors of that number. To make it a little easier for her, he represents the number as a product of N numbers. Alice is frightened of big numbers and hence is asking you for help. Your task is simple. Given N numbers, you need to tell the number of distinct factors of the product of these N numbers.
Input First line of input contains a single integer T, the number of test cases.
Each test starts with a line containing a single integer N. The next line consists of N space separated integers (Ai).
Output For each test case, output on a separate line the total number of factors of the product of given numbers.
Constraints 1 ≤ T ≤ 100, 1 ≤ N ≤ 10, 2 ≤ Ai ≤ 1000000
My Answer
#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long int p = 1, a, c = 0;
    while (n--) {
      cin >> a;
      p *= a;
    }
    for (int i = 1; i <= p; i++) {
      if (p % i == 0)
        c++;
    }
    cout << c << endl;
  }
  return 0;
}
When compiling my program in Codechef, only small numbers are being executed.The larger numbers cannot be compiled. So in Codechef the result is showing "Time Limit Exceeded(TLE)".
 
    