This is Discussion thread about Number Of Divisors
Discussion About Number Of Divisors
#include
#include<math.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long l1;
int perf(int n)
{
int iVar;
float fVar;
fVar=sqrt((double)n);
iVar=fVar;
if(iVar==fVar)
return 1;
else
return 0;
}
int countdivisors(int n)
{
int i,cnt=2;
for(i=2;i<=(int)(sqrt(n));i++)
{
if(n%i==0&&perf(n))
cnt++;
else if(n%i==0)
cnt+=2;
}
return cnt;
}
int main()
{
int t;
cin>>t;
while(t–)
{
l1 n,prod=1,res=0,q;
cin>>n;
l1 a[n];
for(l1 i=0;i<n;i++)
{
cin>>a[i];
prod=prod*a[i];
}
prod=countdivisors(prod);
q=pow(10,9)+7;
res=prod%q;
cout<<res<<endl;
}
return 0;
}
This is my code . It is giving correct output but still on submitting giving wrong answer, don’t know why!!
Please help!