title: finding number of numbers which have prime number of factors
body: <p>The problem is to find the number of divisors of a number</p>
  
  <p>ex-</p>
  
  <pre><code>for 10 
  </code></pre>
  
  <p>ans=4</p>
  
  <p>since 1,2,5,10 are the numbers which are  divisors</p>
  
  <p>i.e. they are the factors</p>
  
  <p>constraints are num&lt;=10^6</p>
  
  <p>I have implemented a code for the same but got TLE!! </p>
  
  <p>here is my code </p>
  
  <pre><code>int isprime[MAX];
  
  void seive()
  {
  
      int i,
      j;
  
      isprime[0] = isprime[1] = 1;
  
      for (i = 4; i &lt; MAX; i += 2) 
          isprime[i] = 1;
  
      for (i = 3; i * i &lt; MAX; i += 2) {
          if (!isprime[i]) {
              for (j = i * i; j &lt; MAX; j += 2 * i) 
                  isprime[j] = 1;
  
          }
  
      }
  
  }
  int main()
  {
  
      seive();
  
      int t;
  
      long long num;
  
      scanf("%d", &amp; t);
  
      while (t--) {
  
          scanf("%lld", &amp; num);
  
  
  
              cnt = 0;
  
              for (j = 1; j * j &lt;= num; j++) {
                  if (num % j == 0) {
                      cnt++;
  
                      if (num / j != j) 
                          cnt++;
  
                  }
  
  
  
  
  
          printf("%lld\n", cnt);
  
      }
  
      return 0;
  
  }
  </code></pre>
  
  <p>Can somebody help me to optimize it?</p>
  
  <p>I have also searched about it but didnot getting any sucess.</p>
  
  <p>So Please help guys. </p>