spoj problem 2

Aug 1, 2014 at 3:14pm
Last edited on Aug 1, 2014 at 3:16pm
Aug 1, 2014 at 3:46pm
Aug 1, 2014 at 4:34pm
As already mentioned in the comments on the SPoJ problem you linked to, brute force is not adequate to solve the problem. Change your algorithm.
Aug 2, 2014 at 2:59am
Generate all the prime numbers first before reading the inputs

Hint: Use prime sieve
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
Topic archived. No new replies allowed.