Subramanyam Shastri and Shrikant Sonone,

Indeed the solution mentioned on
http://code.google.com/codejam/contest/dashboard?c=32016#s=a&a=2 is
pretty awesome but that lays stress on mathematical concepts over
advanced programming logic.... which means that we have to be good
mathematicians first to be a good programmer...

Nah I dont agree....I have a different solution...

Rule 1: Square-roots can be calculated by division while division can
be done by multiplication... (moreover multiplication can be done by
addition but that wont be required here)

Rule 2: If seen from a different perspective each digit of the result
is calculated by a set pattern or simple terms a formula

P.S.: We just need to develop the formula for first and second digit
of the result for n (where n<=2000000000) in terms of multiplying or
adding the digits of the question

Comment: In this approach value of n or the max size of a variable
wont be a constraint. Not just this but any calculation can be done
up-to infinite limits, the only constraint shall be time and space.

Utsav

--


On Sun, Apr 17, 2011 at 11:50 PM, subramanyam shastri
<[email protected]> wrote:
> Please look at contest analysis
> http://code.google.com/codejam/contest/dashboard?c=32016#s=a&a=2
>
> On Sun, Apr 17, 2011 at 1:54 PM, Shrikant Sonone <[email protected]>
> wrote:
>>
>> Problem:
>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p2
>> we have to solve this equation (3 + √5)n and print its last three digits
>> before decimal point
>> My Code runs smooth for Small data sheet where 2<=n<=30
>> but, it gives infinite values on the large data sheet where
>> 2<=n<=2000000000
>> I used long double data type to solve this using pow(x,y) but the is still
>> too high for (3 + √5)2000000000
>> Is there any other method to solve this ?????
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-codejam" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to