Depends on the parameter list of sqr function and also on type of c.If it
takes double as parameter and returns double than false else true,Correct me
if wrong,..
On Fri, May 27, 2011 at 8:56 AM, Balaji S wrote:
> sqr(sqrt(c)) == c
>
> what ll it return if c is 10...
>
>
> --
> You received thi
sqr(sqrt(c)) == c
what ll it return if c is 10...
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegro
bool fn(const float&c)
{//a^2+b^2=c
if (sqr(sqrt(c)) == c) //perfect square
{
float a=1; float b=c-1;
while(a<=b){
float a2=a*a;
float b2=b*b;
if (a2+b2==c) return true;
if (a*2+b2 wrote:
> can anyone help me out with this problem:
> https://www.spoj.pl/problems/TWOSQRS/
> It run
see
http://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares
Hope it'll help...:)
Cheers
~ Jeeva ~
On Thu, May 26, 2011 at 9:17 AM, Balaji S wrote:
> Fermat's little theroem ???
>
> --
> You received this message because you are subscribed to the Google Groups
> "
Fermat's little theroem ???
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more optio
Fermat's theorem will be better for this problem..:)
Cheers
~ Jeeva ~
On Thu, May 26, 2011 at 12:42 AM, Saikat Debnath wrote:
> I think your problem is you are using int. Use long long.
>
>
> On Thu, May 26, 2011 at 12:29 AM, ricky wrote:
>
>> can anyone help me out with this p
I think your problem is you are using int. Use long long.
On Thu, May 26, 2011 at 12:29 AM, ricky wrote:
> can anyone help me out with this problem:
> https://www.spoj.pl/problems/TWOSQRS/
> It runs on my machine with this code but it gives wrong ans on their
> site.
>
> #include
> #include
>
>
can anyone help me out with this problem: https://www.spoj.pl/problems/TWOSQRS/
It runs on my machine with this code but it gives wrong ans on their
site.
#include
#include
using namespace std;
int main()
{
int i=0,j=0,X=0,t=0,count=0;
cin>>t;
while(t--)
{
cin>>X;
i=sqrt(X);
j=sqrt(X-i*i);