time limit exceeded for one test case , two cases are accepted .
code link - https://ide.codingblocks.com/s/99132
Prime visit TLE IN ONE CASE
Hi @Ajaypandey
You need to use the Sieve Technique discussed in Number Theory Section for this problem or you are bound to get a TLE. Sieve is an optimised technique to precompute prime numbers and is extremely useful for problems related to prime numbers.
@Ajaypandey
No. You need use Sieve or some modified version of Sieve to solve this problem. Problems where you have to handle operations on Prime Numbers and there are testcases involved should always be handled using Sieve or they will give TLE.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.