jmagum :WA

jmagum
loc
sep
sieve

#1

Getting wrong answer

link for my code


#2

your code does not pass the sample test cases. There is no need of using MOD as it’s not mentioned in the question. Luckily the maximum possible answer is less than MOD so it didn’t effect. Link to AC Code

Notes:

  1. loop has to run till 10^6 as sqrt M will miss out some prime factors

#3

your loop runs from i=2 to sqrt(M)… i think it should run till M. There can be a prime number between sqrt(M) and M whose place needs to be updated with sum of its digits which in your case is left zero.


#4

Yes @doramon I was also getting wrong answer when i used i*i<=m

But When I changed i*i<=m to i<=m I got accepted

So just change this only and get accepted


#5

https://www.codechef.com/viewsolution/15554603 (Wrong Answer)

This was giving wrong answer

But when i changed i*i<=m to i<=m I got accepted

https://www.codechef.com/viewsolution/15554608 (Correct Answer)

I hope now it helps @doramon


#6

not only that line! He’s using MOD which changes the actual answer!
IGNORE THIS COMMENT


#7

but how mod will affect answer?? all number will be in range.i guess…


#8

@swetankmodi - The Q does ask for mod. Here is the line-

Print the required output with modulus 10**9+7 for each test case in a seperate line.


#9

Got it.it’s not available in practise section.i’ll chck it myself :slight_smile:


#10

@vijju123 sorry, I didn’t even read that. My code got AC during the contest without mod haha xD. My bad. This was a blunder :\


#11

I read it and ignored it :stuck_out_tongue:

Sum of digits <<<<<<<<10^9 XD