My issue
my output is comming correct but it is not satisfyinh all the testcases
My code
#include <bits/stdc++.h>
using namespace std;
int fact(int m){
int factorial=1;
for(int i=1;i<=m;i++){
factorial=factorial*i;
}
return factorial;
}
int main() {
// your code goes here
int n,m;
cin>>n>>m;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int brr[n];
for(int i=0;i<n;i++){
brr[i]=fact(m)*arr[i];
}
for(int k=0;k<n;k++){
int count=0;
for(int h=1;h<=brr[k];h++){
if(brr[k]%h==0){
count++;
}
else{
continue;
}
}
cout<<count<<" ";
}
}
Problem Link: Divisors Array (Hard Version) Practice Coding Problem