1.

import java.math.BigInteger;
import java.util.ArrayList;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 485 - Pascal's Triangle of Death
* Link:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=6&problem=426&mosmsg=Submission+received+with+ID+7613568
*
* @author Kratzer Kevin
* @version 1.0, 12/09/2009
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.828
*/
public class Main485 {
private final static BigInteger limit = BigInteger.TEN.pow(60);
public static void main(String... args) {
boolean running = true;
ArrayList<BigInteger> lastList = new ArrayList<BigInteger>();
lastList.add(BigInteger.ONE);
lastList.add(BigInteger.ONE);
System.out.println("1");
System.out.println("1 1");
ArrayList<BigInteger> nextList;
while(running) {
nextList = new ArrayList<BigInteger>();
addNPrint(nextList,BigInteger.ONE, true);
for(int i = 0; i < lastList.size()-1; i++) {
BigInteger newElement = lastList.get(i).add(lastList.get(i+1));
if(newElement.compareTo(limit) >= 0) {
running = false;
}
addNPrint(nextList,newElement, true);
}
addNPrint(nextList,BigInteger.ONE, false);
lastList = nextList;
}
}

private final static void addNPrint(ArrayList<BigInteger> list, BigInteger element, boolean space) {
list.add(element);
if(space) {
System.out.print(element + " ");
} else {
System.out.println(element);
}
}
}