Number of Divisors prob

TLE problem
#include
using namespace std;

int main() {
int t;
cin>>t;
while(t–){

    int n;
    cin>>n;
    int *a=new int[n];
    
    for(int i=0;i<n;i++){
        cin>>a[i];
        
    }
   long long int num=1;
     float ans=0;
    for(int i=0;i<n;i++){
        num=num*a[i];        }

    for(int j=1;j*j<=num;j++){
        if(num%j==0){
            ans++;
        }
        if(j*j==num){
            ans=ans-0.5;
        }
    }
    long long int tt=2*ans;
    long long int fin=tt%(1000000007);
    
    cout<<fin<<endl;
    
}


return 0;

}

Question link
https://hack.codingblocks.com/contests/c/452/815

As you are multiplying all elements of array , it may get large enough to not fit it in ans variable , so think about other appproach . Precompute all primes less than 10000000 and find prime factors of each elements of array .
If you still need help then take help of this -->>
https://ide.codingblocks.com/#/s/15329