UVa 498

From Algorithmist
Jump to navigation Jump to search

498 - Polly the Polynomial[edit]

Summary[edit]

Evaluate a polynomial (first line) for all the values of the second line.

Explanation[edit]

http://en.wikipedia.org/wiki/Horner%27s_method

Implementations[edit]

  • If you use sscanf, you will have to do: bytes_read += bytes and sscanf(Str+bytes_read ...
  • Don't print a space at the end of a line.
  • Don't use doubles or power functions.

Input[edit]

-2
5 0 1 6
1 -1
7 6 -1
0
1 2 34
-10 -20 -600 34
2 4 3042

Output[edit]

-2 -2 -2 -2
6 5 -2
0 0 0
-1326 -3326 -281686401326

References[edit]

  1. http://acm.uva.es/board/search.php?keywords=498
  2. http://acm.uva.es/board/viewtopic.php?f=17&t=3734&p=183725&hilit=498&sid=a022f78e2ee1a7ba67c3bf3d500853ba#p183725