Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя levi.ackerman1732

Автор levi.ackerman1732, история, 5 лет назад, По-английски

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

  • Проголосовать: нравится
  • +29
  • Проголосовать: не нравится

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +26 Проголосовать: не нравится

I accept your code!

your problem was pow() function because its returns double and double has error! you can compare your code with mine to see the problem:)