You are not logged in. Please login at www.codechef.com to post your questions!

×

jmagum :WA

Getting wrong answer

link for my code

asked 03 Oct '17, 00:02

doramon's gravatar image

1★doramon
865
accept rate: 5%

edited 03 Oct '17, 00:10


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
link

answered 03 Oct '17, 00:22

swetankmodi's gravatar image

6★swetankmodi ♦♦
6008
accept rate: 15%

edited 03 Oct '17, 02:11

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.

link

answered 03 Oct '17, 00:36

mohitkurani98's gravatar image

5★mohitkurani98
2525
accept rate: 14%

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

link

answered 03 Oct '17, 01:01

spp____'s gravatar image

2★spp____
1.1k211
accept rate: 7%

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

(03 Oct '17, 01:33) swetankmodi ♦♦6★

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

(03 Oct '17, 01:36) doramon1★

@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.

(03 Oct '17, 01:41) vijju123 ♦♦4★

@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 :\

(03 Oct '17, 02:11) swetankmodi ♦♦6★

I read it and ignored it :p

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

(03 Oct '17, 02:50) vijju123 ♦♦4★

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

link

answered 03 Oct '17, 01:50

spp____'s gravatar image

2★spp____
1.1k211
accept rate: 7%

Got it.it's not available in practise section.i'll chck it myself :)

(03 Oct '17, 01:56) doramon1★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×301
×135
×10
×2

question asked: 03 Oct '17, 00:02

question was seen: 384 times

last updated: 03 Oct '17, 02:50