This soltion to the Prime Palindromes (PRPALIN) problem precomputes all of the prime palindromes. Is this allowed?
If not, to what level can we precompute? For this problem, can we give ourselves a sieve of primes up to 1,000 to check if a number is prime? If not, can we give ourselves a sieve of primes up to 32 so we can precalculate the primes up to 1,000 before taking in input?
It is not exactly a problem if you do it. For bigger problems, you will be limited by the source limit (50000 bytes). So as long as your code is within the source limit, it is fine. However, considering the spirit of problem solving, it is advised to write codes which do not use pre-computed values
1 Like
Thank you for the clarification! This really does help.
Is can be done and it is valid but you wont learn anything if you do it that way .
such a precomputation helps usually in short-contests where every second matters a lot. But it is not against the rules, and a lot of programmers do it. But do keep in mind that you must have a thorough practice/understanding of such concepts, so that you can do the question without precomputation you face such a problem where precomputation will not work…
1 Like