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

×

Square digit squares: getting wa

asked 26 Mar '14, 00:15

akki16's gravatar image

3★akki16
51210
accept rate: 0%

at n=10000000000 its giving an answer of 99 while it should give 117.. i am not able to understand the error which i have made.

(26 Mar '14, 00:41) akki163★

Your approach is correct. The basic error in your code is that you have take the data type of the variable i as integer and then you are multiplying two integers and storing the result in long long int. But 10^5 * 10^5 would overflow integer and hence a negative value will go inside num (long long int) variable. Correct that error.

link

answered 26 Mar '14, 02:33

vermashubhang's gravatar image

5★vermashubhang
1.5k11025
accept rate: 23%

hey! thanks a lot :) it got accepted. thanku :)

(26 Mar '14, 19:22) akki163★
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:

×1,070

question asked: 26 Mar '14, 00:15

question was seen: 563 times

last updated: 26 Mar '14, 19:22