T primes Problem, solution working fine on my system but failing on the Codeforces server

Revision en1, by levi.ackerman1732, 2020-01-03 13:36:09

230B - T-primes

Hello all,

I am a bit new to this online coding platform hence I am sorry if I am asking anything that is fairly obvious. Getting to the solution of the question: If a number has to be T-Prime, it has to be a perfect square of a prime number.

My algo: 1)check if the number is a perfect square. 2)If it is a perfect square check if the square root is a prime number.

Problem I am facing: My code is working fine for many test cases, but failing at test case 16 with an error(wrong answer 28561st lines differ — expected: 'NO', found: 'YES') The input for 28561th line is 28561(169*169). In my system it is showing "NO" (not a t prime) which is correct.

I don't know where it went wrong. Any help is appreciated. Thank you.

My submission

Tags #implementation, #math, #binary search, #number theory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English levi.ackerman1732 2020-01-03 13:36:09 935 Initial revision (published)