Page 2 of 2

Weird??

Posted: Fri Nov 14, 2003 8:57 am
by kurnia w
when i declare variable using double my compiler give the answer
1562562500624999940 which is WA

then when i changed it to long long the answer is
85550656 which is AC

actually what is the output for 50000 ??
am i missing something here??
can someone explain to me this simple question.. :(
thanks

Posted: Mon Mar 08, 2004 4:41 pm
by Dejarik
Please, if some of you got the correct answer for this "stupid" problem, can you post examples with extra-large numbers? (i.e., post inputs and outputs of as great numbers as you can)

I think i'm near the correct answer, only a rare overflow output may be the reason of my wrong answers...

Thanks in advance!

kurnia

Posted: Tue Mar 09, 2004 6:31 pm
by osan
i think u use Turbo C++
that why you got

when i declare variable using double my compiler give the answer
1562562500624999940 which is WA

then when i changed it to long long the answer is
85550656 which is AC

long long doesn't work in TC & long long count as long in TC. if you use Dev you can find the result. or in VC you can int64 as data type.

for 50000 the result may be
1562562500625000000.

thanks everyone

Posted: Tue Mar 09, 2004 6:43 pm
by osan
guys i was in real problem. i was getting WA. i was using data type as long long. but i changed it into long double then got AC.

& in long double the output for 50000 is 1562562500624999900.

Posted: Tue Mar 09, 2004 7:51 pm
by mido
Just wanted to say a long overdue thanks.....:)

10302 I want to learn (Polynomials)

Posted: Sat Jun 04, 2005 10:20 pm
by gateKeeper
I've solved the problem "Summation of Polynomials" recently, using the expression n * n * (n + 1) * (n + 1) /4 . This expression was calculated following the steps described in the "introduction" of the problem, I suppose. Unfortunately I can't understand those steps.

Can someone explain me how to do that? I would be grateful...
Thanks

10302 [Polynomials] getting WA?

Posted: Mon Jul 04, 2005 1:26 pm
by Salman
Here is the code

Code: Select all


     removed after AC
use long long to get AC.

10302 - data types is long long

Posted: Tue Sep 27, 2005 8:41 am
by Salman
Hi

If u r using (n*n*(n+1)*(n+1))/4 formula then use long long data type . It works for me and I got AC.

Salman

Help reqd

Posted: Wed Jan 31, 2007 5:14 pm
by Viswanathan V
Am getting WA...and even my compiler gives my some problem...
can anyone tell me whats the problem..

here's my code....

<deleted after acceptence>

Posted: Thu Feb 01, 2007 9:19 am
by tgoulart
Use long long and you will get AC.

Posted: Fri Feb 02, 2007 3:43 am
by Viswanathan V
Thanks a lot man....got accepted.

Posted: Fri Feb 02, 2007 4:01 am
by helloneo
If you got AC, remove your code plz.. :)

Re: 10302 - Summation of Polynomials

Posted: Thu Oct 14, 2010 1:46 pm
by faiem
whats the problem of the formula (n*(n+1)/2)^2 ???
i got AC.but using another formula to solve it.
anyone can explain me whats happen with this formula???

Re: 10302 - Summation of Polynomials

Posted: Sat Jun 30, 2012 4:15 am
by 3sam
please can anyone tell me why this code is WA ???


#include<iostream>
using namespace std;
int main()
{
long long n;
while(cin>>n)
{
long long N;
long long result=0;
long long sum =0;
for(int i=1;i<=n;i++)
{
while(sum<(i*i*i))
{
N=1;
sum+=(N*N*N);
N++;
}
result+=sum;
}
cout<< result<<endl;
}
return 0;
}

Re: 10302 - Summation of Polynomials

Posted: Mon Jul 02, 2012 10:10 pm
by brianfry713
Input 50000, AC Output 1562562500625000000