long int n,count=0;
long int a[n];
int fact(int z)
- First, please format your code by putting it between three backticks like so:
``` Code ```. Otherwise it’s completely unreadable.
- You actually compute something complete different: you compute all pairwise products, compute the number of divisors for each one, and sum them up. Read the question again. The question asks for each
j, to compute the product of all numbers without
a[j], then count the divisors and sum the up.
- Be careful, in the line
a[j] * a[g]happens an integer overflow.
- There are a lot faster ways to compute the number of divisors of a number, once you have a prime factorization. For learning it, check out this article.
- But that speedup will still not be enough for solving the problem. You need some clever ideas, to make it work. Check out the editorial for the solution: KETEKI2C editorial
thanks budy it was very helpful to me…