Problem name: NUMFACT

Problem link: Contest Page | CodeChef

My logic: Multiply all the given n number to form the original number, and just count the number of distinct divisors of the original number.

My code results in WA, can anybody correct me. Thanks in advance.

Code:

#include <bits/stdc++.h>

using namespace std;

#define fastio()

ios_base::sync_with_stdio(false);

cin.tie(NULL);

cout.tie(NULL);

#define lli long long int

#define ll long long

int cnt_factors(int n)

{

int ans=0;

```
for(int i=1;i*i<=n;i++)
{
if((n%i)==0)
{
ans++;
if(i!=(n/i)) ans++;
}
}
return ans;
```

}

void solve()

{

int n; cin>>n;

```
int prod=1;
for(int i=0;i<n;i++)
{
int x; cin>>x;
prod*=x;
}
cout<<cnt_factors(prod)<<'\n';
return;
```

}

int main()

{

fastio();

int t=1;

cin>>t;

while(t–) solve();

```
return 0;
```

}