cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
spoj problem 2
spoj problem 2
Aug 1, 2014 at 3:14pm
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
Aug 1, 2014 at 3:16pm UTC
Aug 1, 2014 at 3:46pm
Aug 1, 2014 at 3:46pm UTC
ResidentBiscuit
(4459)
Read
http://www.cplusplus.com/forum/beginner/1/
Aug 1, 2014 at 4:34pm
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
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.