1. 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
* Angewandte Mathematik, SS11
* Problem: 10719 - Quotient Polynomial
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=19&page=show_problem&problem=1660
*
* @author Benedikt Z¨nnchen
* @author Erik Wenzel
* @version 1.0, 10/05/2011
*
* Method : Hornerschema
* Status : Accepted
* Runtime: 1.708
*
* Erkl¦rung: Nach Horner kann jedes Polynom p(x) = ((((x-1)*x-3)*x+2)*x+1) (Beispiel) dargestellt werden.
* => teilt man p(x) / (x-k) sind die neuen Faktoren a wie folgt: a_1 = a_1(vorher), a_2 = a_1*k+a_2(vorher)
*/
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;

while((line=reader.readLine())!=null)
{
int k = Integer.parseInt(line);
String[] p = reader.readLine().split(" ");
int[] q = new int[p.length];

if(p.length<2)
{
System.out.println("q(x):");
System.out.println("r = " + Integer.parseInt(p[0]));
continue;
}

// erster Faktor ist auf jedenfall gleich dem ersten alten Faktor!
q[0]=Integer.parseInt(p[0]);

System.out.print("q(x): " + q[0]);

// ein Element f¦llt auf jeden Fall heraus => i=1 und 1fr¾her abbrechen
for(int i = 1; i<q.length-1; i++)
{
q[i]=q[i-1]*k+Integer.parseInt(p[i]);
System.out.print(" " + q[i]);
}

// Berechung des Rests r
int r = q[q.length-2]*k+Integer.parseInt(p[q.length-1]);
System.out.println("\nr = " + r);
System.out.println();
}
}
}

2.

/**
* Angewandte Mathematik, SS11
* Problem: 10719 - Quotient Polynomial
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=19&page=show_problem&problem=1660
*
* @author Fabian Trampusch
* @author Robert Schwarz
* @version 1.0, 15/05/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.720
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] coefficients = null;
int[] resultPolynom = null;
int divisor = 0; // is called "k" in description
int remainder = 0;

while (true) {
try {
divisor = Integer.parseInt(br.readLine());
coefficients = readIntArr(br.readLine());
} catch (Exception e) {
return;
}

resultPolynom = new int[coefficients.length];

int adder = 0;

for (int i = 0; i < coefficients.length; i++) {
resultPolynom[i] = coefficients[i] + adder;
adder = resultPolynom[i] * divisor;
}

StringBuilder sb = new StringBuilder("q(x):");
for (int i = 0; i < resultPolynom.length - 1; i++) {
sb.append(" " + resultPolynom[i]);
}

System.out.println(sb);
System.out.println("r = " + resultPolynom[resultPolynom.length - 1]);
System.out.println();
}
}

public static int[] readIntArr(String line) throws Exception {
StringTokenizer st = new StringTokenizer(line);

int countElements = st.countTokens();
int[] readInts = new int[countElements];

for (int i = 0; i < countElements; i++) {
readInts[i] = Integer.parseInt(st.nextToken());
}

return readInts;
}
}

3.
/**
* Angewandte Mathematik, SS11
* Problem: 10719 - Quotient Polynomial
* http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=19&problem=1660&mosmsg=Submission+received+with+ID+8880080 *
* @author Marco Wolff
* @author Christian Weber
* @author Christoph Waldleitner
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 1.544
*/

import java.io.*;
public class Quotient_Polynomial
{
public static void main(String[] args) throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input;

while((input = br.readLine())!= null)
{
int k = Integer.parseInt(input);
String[] array = br.readLine().split(" ");
System.out.print("q(x):");
if(array.length<2)
{
System.out.println("\n"+"r = "+array[0]);
continue;
}
int a = Integer.parseInt(array[0]);
for(int j = 1; j<array.length;j++)
{
System.out.print(" "+a);
int b = Integer.parseInt(array[j]);
if(a!=0)
a = b+(k*a);
else
a=b;
}
System.out.println("\n"+"r = "+a+"\n");
}
System.exit(0);
}

}