I used this method, x & y is range and it return the count.
methode checkPalindrom(i) return true if given value is palindrom otherwise
false.


public static int getFairSqur(double x, double y){
int count=0;
long x1 = (long)Math.ceil(Math.sqrt(x));
long y1 = (long)Math.sqrt(y);

for(long i=x1; i<=y1; i++ ){
if(checkPalindrom(i)){
long sq=i*i;
if(checkPalindrom(sq)){
// System.out.println("("+i+")");
count++;
}
}
}
return count;
}








Regards,

*Niraj Kumar*

B.Tech. CSE
Class of 2012
ISM, Dhanbad
8274952350



On Wed, Apr 17, 2013 at 10:26 AM, ayman bs <[email protected]> wrote:

> You want to look for a number that its square is below 16. Do you have
> to go up to 16 or you may stop at the square root of 16. Can you come
> up with a number larger than 4 that has a square less than 16?
>
> That's the same for the large test case, the biggest a number can be
> is 10^14 but can you come up with a number larger than 10^7 that is
> when squared is less than 10^14 ?
>
> On Tue, Apr 16, 2013 at 11:58 PM, Dax Joshi <[email protected]> wrote:
> > I have a question for the same problem, If I am solving in Java.
> >
> > I used long to solve large input file and my program hanged executing.
> Which
> > is appropriate data type to have such large number ?
> >
> > Thanks.
> >
> >
> > On Wed, Apr 17, 2013 at 7:28 AM, astronauta <[email protected]>
> wrote:
> >>
> >> When reading contest analysis about problem C, I saw what follows:
> >>
> >> "We don't really need to go all the way up to 10^14 though! We are
> >> interested in numbers whose squares are Fair and Square and between A
> and B
> >> - and that means we have to check up to the square root of B only.
> That's
> >> only 10^7 numbers to check in the worst case."
> >>
> >> I didn't understand what it means. Could anybody please give me some
> >> example to this scenario?
> >>
> >> Thanks.
> >>
> >> --
> >> 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 [email protected].
> >> To post to this group, send email to [email protected].
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msg/google-code/-/R67mbHBTQi8J.
> >> 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 [email protected].
> > To post to this group, send email to [email protected].
> > 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to