#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
unordered_map<ll,ll> m;
void calc(ll num){
for(ll i=2;ii<=num;++i){
if(num%i==0){
int count=0;
while(num%i==0){
num=num/i;
count++;
}
m[i]+=count;
}
}
if(num>2){
m[num]+=(ll)1;
}
}
ll sumdiv(){
ll ans=1;
for(auto x:m){
ans=((ans%mod)(x.second+1)%mod)%mod;
}
return ans%mod;
}
int main(){
ll t;
cin>>t;
while(t–){
ll n;
cin>>n;
for(ll i=0;i<n;++i){
ll num;
cin>>num;
calc(num);
}
ll ans=sumdiv();
cout<<ans<<endl;
m.clear();
}
}
Problem in code question is Number of divisors
share code in cb ide
how can i share it in cb ide?
paste ur code
here
then go to file
then save
u`ll get a updated url share here
i am unable to share my code on cb id here is my code.
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 unordered_map<ll,ll> m; void calc(ll num){ for(ll i=2;ii<=num;++i){ if(num%i==0){ ll count=0; while(num%i==0){ num=num/i; count++; } m[i]+=count; } } if(num>2){ m[num]+=(ll)1; } } ll sumdiv(){ ll ans=1; for(auto x:m){ ans=(ans((x.second+1)%mod))%mod; } return ans; } int main(){ ll t; cin>>t; while(t–){ ll n; cin>>n; for(ll i=0;i<n;++i){ ll num; cin>>num; calc(num); } ll ans=sumdiv(); cout<<ans<<endl; cout.flush(); m.clear(); } }