a4aakash's blog

By a4aakash, history, 4 weeks ago, In English,

Here is my solution link Click Here. It is giving correct output when running on any online compiler but when submitting it, then its output varies from the original one. So please help. Thank you in advance!

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

In this question you have to check that the given number is square of a prime number or not ?. For this your algorithm of sieve is wrong in your code, you should use the array of size upto 1000001, there is no need to use set, you should keep in mind the typecasting of the square root of number must be int to check that it is prime or not in the index of sieve array, and there should be int overflow in the checking the square root is a int or float of the given number, refer to my Code :)