10302 - Summation of Polynomials

All about problems in Volume 103. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

Weird??

Post by kurnia w » Fri Nov 14, 2003 8:57 am

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

Dejarik
New poster
Posts: 32
Joined: Sun Mar 07, 2004 1:23 pm
Location: Barcelona, SPAIN
Contact:

Post by Dejarik » Mon Mar 08, 2004 4:41 pm

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!

osan
New poster
Posts: 47
Joined: Tue Jul 29, 2003 12:03 pm
Location: Bangladesh,Dhaka.
Contact:

kurnia

Post by osan » Tue Mar 09, 2004 6:31 pm

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.

osan
New poster
Posts: 47
Joined: Tue Jul 29, 2003 12:03 pm
Location: Bangladesh,Dhaka.
Contact:

thanks everyone

Post by osan » Tue Mar 09, 2004 6:43 pm

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.

mido
Learning poster
Posts: 78
Joined: Sun Jun 16, 2002 9:48 pm
Location: Cairo,Egypt

Post by mido » Tue Mar 09, 2004 7:51 pm

Just wanted to say a long overdue thanks.....:)

gateKeeper
New poster
Posts: 2
Joined: Sat Jun 04, 2005 10:07 pm

10302 I want to learn (Polynomials)

Post by gateKeeper » Sat Jun 04, 2005 10:20 pm

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

Salman
New poster
Posts: 25
Joined: Thu Jun 26, 2003 9:45 am

10302 [Polynomials] getting WA?

Post by Salman » Mon Jul 04, 2005 1:26 pm

Here is the code

Code: Select all


     removed after AC
use long long to get AC.

Salman
New poster
Posts: 25
Joined: Thu Jun 26, 2003 9:45 am

10302 - data types is long long

Post by Salman » Tue Sep 27, 2005 8:41 am

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

Viswanathan V
New poster
Posts: 8
Joined: Mon Jan 22, 2007 9:08 pm

Help reqd

Post by Viswanathan V » Wed Jan 31, 2007 5:14 pm

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>
Last edited by Viswanathan V on Fri Feb 02, 2007 7:19 pm, edited 1 time in total.

tgoulart
New poster
Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

Post by tgoulart » Thu Feb 01, 2007 9:19 am

Use long long and you will get AC.
Thiago Sonego Goulart - UFMG/Brazil

Viswanathan V
New poster
Posts: 8
Joined: Mon Jan 22, 2007 9:08 pm

Post by Viswanathan V » Fri Feb 02, 2007 3:43 am

Thanks a lot man....got accepted.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Fri Feb 02, 2007 4:01 am

If you got AC, remove your code plz.. :)

faiem
New poster
Posts: 14
Joined: Fri Aug 13, 2010 12:22 pm

Re: 10302 - Summation of Polynomials

Post by faiem » Thu Oct 14, 2010 1:46 pm

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???

3sam
New poster
Posts: 6
Joined: Mon Apr 09, 2012 8:33 pm

Re: 10302 - Summation of Polynomials

Post by 3sam » Sat Jun 30, 2012 4:15 am

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;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10302 - Summation of Polynomials

Post by brianfry713 » Mon Jul 02, 2012 10:10 pm

Input 50000, AC Output 1562562500625000000
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 103 (10300-10399)”