Search:
Forum
Beginners
spoj problem 2
spoj problem 2
Aug 1, 2014 at 3:14pm UTC
Aman Agarwal
(4)
http://www.spoj.com/problems/PRIME1/
http://ideone.com/JPHnqd
but it says TLE..
help me out,..
Last edited on
Aug 1, 2014 at 3:16pm UTC
Aug 1, 2014 at 3:46pm UTC
ResidentBiscuit
(4459)
Read
http://www.cplusplus.com/forum/beginner/1/
Aug 1, 2014 at 4:34pm UTC
cire
(8284)
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 UTC
Smac89
(1727)
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.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs