int a=2*r+1;
int d=4;
double d=-(2*a-d)+Math.sqrt((2*a-d)*(2*a-d)+8*d*k);
int dinominator=2*d;
int result=d/dinominator;
answer is result


On Sun, Apr 28, 2013 at 7:35 AM, bas <366a...@gmail.com> wrote:

> The result of that formula is very large, so there is a possibility
> that it will not fit into a 64-bit integer.
> The first comparison uses 'double' type to check if this number is too
> large. If it is, it is certainly bigger than t. If it is not, more
> precise integer computations can be used (second comparison).
> I guess 1.5 is just a large enough number to be safe.
>
> I personally used 'unsigned long long' instead, and that was enough to
> avoid dealing with floating point calculations.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to