150A — Win or Freeze

Правка en1, от BL7A., 2017-12-06 21:18:40

I was trying to solve 150A and I submitted a solution where I used a variable ( i ) in a loop :

for(int i=2; i*i<=n; i++)
    {
        while(n%i == 0)
        {
            n /= i;
            p[k++] = i;
        }
    }

and it got TLE in test 7

submission : 32983991

and when I changed the datatype of variable ( i ) to long long it got accepted.

submission : 32984272

can anyone help me with the reason...?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский BL7A. 2017-12-06 21:18:40 497 Initial revision (published)