## 766 - Sum of powers

Moderator: Board moderators

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

### 766 - Sum of powers

Hi,

I'm getting WA for this problem. I'm basically doing polynomial interpolation (Newton form). It seems to work quite well, at least for small cases like k = 5 (I get "12 2 6 5 0 -1 0 0", which I think is correct). And I have learned from Integer Sequences Encyclopedia that my "denominators" (M) are all correct.

Could any one please give me the output for "extreme cases" like k = 0 or k = 20? (I get some pretty larger numbers for k = 20; is this wrong?) Are there any other traps?

7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
Your output for k=5 is correct, and the output for k=0 is obviously "1 1 0". Giving the output for k=20 would be too much of a spoiler, I think, but the numbers get pretty big: the smallest is -47625039 and the biggest is 44767800.

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong
Thanks little joey. I've got accepted.

My mistake was really that I had the answer for k = 20 wrong. Two of the coefficients I had were clearly wrong. I wonder why I didn't see it... Thanks again!!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

### 766 P.E. Tried Everything.... Always P.E.

Hi,

I keep getting P.E. for 766. I follow the output format
exactly and get P.E. I then try 20 different formats with extra
spaces, etc., and still get P.E. What is the correct
format for this problem? Thanks. Here is what my output looks like
when streamed to a file. Note the last line is just EOF, i.e.
a newline after the last ouput and EOF.

Anyway, I would really appreciate some help. Thanks.

Code: Select all

``````AC

``````
Last edited by baodog on Wed Jul 04, 2007 10:04 pm, edited 1 time in total.

mmonish
Experienced poster
Posts: 109
Joined: Sun Mar 11, 2007 2:55 pm
Location: SUST
>>baodog

Code: Select all

``Print a blank line between datasets.``

This means that there is no blank line after the last output.

Hope this helps.

Ryan Pai
Learning poster
Posts: 67
Joined: Fri Jul 04, 2003 9:59 am
Location: USA
Contact:
It looks like you're printing extra spaces at the end of some lines. You probably don't want to do that.
I'm always willing to help, if you do the same.

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

### Still getting PE

As I indicated, I didn't print a blank line after the last output. There is only a '\n', newline after the last output. I have also tried no newline
at the end, and still get PE. Thanks.

ayeshapakhi
Learning poster
Posts: 60
Joined: Sun Apr 16, 2006 7:59 pm
there's only two specifications...
and these are enough..

Code: Select all

``````Numbers should be separated by one space.
Print a blank line between datasets.``````
1st one requires that there'll be no spaces after the last number in a line.

hope these help..

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

### Weird PE Problem

Still getting PE!
No Spaces are printed at the end of lines.
Blank Lines between outputs, and no blank line
after the last output. Of course I can read.
No idea why. Maybe the judge's output file got
corrupted recently, or they made some mistake
while changing the output file recently. I bet that if
you got AC before, and if you resubmit, you will get PE.

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

### Re: Weird PE Problem

baodog wrote:Of course I can read.
Nothing has changed recently, so maybe you should consider the possibility that your program is wrong.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am
I didn't mean to be impolite. I really appreciate your help. Now, I have taken my output for n=0..20, put it in a program as an array of strings, read the numbers back in using streams, and output it again according to the format (blank lines between outputs, one space between each number, nothing else, so simple) ... Still PE.... I apologize for posting this PE code, I will remove it as soon as someone spots the problem.

Code: Select all

``````AC
``````
Last edited by baodog on Wed Jul 04, 2007 9:47 pm, edited 1 time in total.

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:
"30 615 10 0 -1 0",
That should be "30 6 15 10 0 -1 0".

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

### problem resolved..

Thanks!! Really appreciate it. I had a missing delimiter
in one special case output in the original program....
can't believe I didn't see it ....

alex_gab
New poster
Posts: 1
Joined: Fri Apr 03, 2015 10:55 pm

### Re: 766 - Sum of powers

Are there any known issues with judge outputs?
I get a "Wrong Answer", though I know my output is correct.

I also want to ask if the below output is correctly formatted?
4

2
6 2 3 1 0

5
12 2 6 5 0 -1 0 0

0
1 1 0

16
510 30 255 680 0 -2380 0 8840 0 -24310 0 44200 0 -46988 0 23800 0 -3617 0

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