
ZOJ Problem Set  2191
Boudreaux and Thibodeaux aren't very good at math, so they need you to write a program that can determine the second degree polynomial used to generate a given sequence of three integers. As proof that you've figured out the polynomial, they want your program to print out the next 3 integers in the sequence. You know that each sequence is generated by a polynomial of the form f(x) = Ax^{2} + Bx + C, where A, B, and C are integers in the range (10^{3} ≤ (A, B, C) ≤ 10^{3}). You are given the values f(0), f(1), f(2) and are to determine the values f(3), f(4), f(5). Input: Input to this problem will consist of a (nonempty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets. Each data set consists of a single line containing the spaceseparated integer values of the polynomial evaluated at 0, 1, and 2 (in that order). These values will be in the range (10^{3} ≤ (f(0), f(1), f(2)) ≤ 10^{3}). Output For each data set, there will be exactly one line of output containing the spaceseparated integer values of the polynomial evaluated at 3, 4, and 5 (in that order). These values will be in the range (10^{4} ≤ (f(3), f(4), f(5)) ≤ 10^{4}). Sample Input
0 0 0 Sample Output
0 0 0 Source: South Central USA 2003 