1.

/**
* Angewandte Mathematik, SS11
* Problem: 485 - Pascal's Triangle of Death
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=426
*
* @author Markus Schöllner
* @author Andreas Maier
* @version 1.0, 04/20/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 1.244
*/

import java.math.BigInteger;

public class Main {

public static void main(String[] args) {

BigInteger finalValue = BigInteger.TEN;
for(int c = 2; c <= 60; c++) finalValue = finalValue.multiply(BigInteger.TEN);

BigInteger[] current = new BigInteger[10000];
current[0] = current[1] = BigInteger.ONE;
BigInteger[] next = new BigInteger[10000];

System.out.println(1);
System.out.println("1 1");

int line = 1;
boolean end = false;


while(end==false) {
next[0] = BigInteger.ONE;

for(int c = 1; c <= line; c++) {
next[c] = current[c].add(current[c-1]);
if(next[c].compareTo(finalValue)>= 0) end = true;
}
next[++line] = BigInteger.ONE;

for(int i = 0; i<line;i++){
System.out.print(next[i]+" ");
current[i] = next[i];
}
System.out.println(1);
current[line] = BigInteger.ONE;
}
}
}

2.

import java.math.BigInteger;


public class Main {

/**
* Angewandte Mathematik, SS11
* Problem: 485 - Pascal's Triangle od Death
* Link: http://uva.onlinejudge.org/external/4/485.pdf
*
* @author Pirmin Schneider
* @author Peter Weis
* @version 1.0, 05/1/2011
*
* Method : Ad-Hoc
* Status: Accepted
* Runtime: 1.140:
*/

public static void main(String[] args) {

BigInteger currentLine[] = new BigInteger [10000];
BigInteger nextLine[] = new BigInteger [10000];

// set limit to 10^60
BigInteger limit = BigInteger.TEN.pow(10);
boolean finish = false;
int line = 1;

// begin with two ones
currentLine[0] = currentLine[1] = BigInteger.ONE;

// print out the first two lines
System.out.println ("1");
System.out.println ("1 1");

while (!finish) {

// for every line begin with a one
nextLine[0] = BigInteger.ONE;

// a number is the sum of its two ancestors in its previous line
for (int i = 1; i <= line; i++) {
nextLine[i] = currentLine[i].add(currentLine[i - 1]);

// calculation goes on as long we dont have a number higher than the limit
if (nextLine[i].compareTo(limit) >= 0 ) finish = true;
}
nextLine[++line] = BigInteger.ONE;

// print all lines out

for (int j = 0; j < line; j++) {
System.out.print(nextLine[j] + " ");
System.out.print(nextLine[j] + " ");
System.out.print(currentLine[j] + " ");
currentLine[j] = nextLine[j];
}
System.out.println ("1");
currentLine[line] = BigInteger.ONE;
}
}
}

3.

import java.math.BigInteger;


public class Main {

/**
* Angewandte Mathematik, SS11
* Problem: 485 - Pascal's Triangle od Death
* Link: http://uva.onlinejudge.org/external/4/485.pdf
*
* @author Pirmin Schneider
* @author Peter Weis
* @version 1.0, 05/1/2011
*
* Method : Ad-Hoc
* Status: Accepted
* Runtime: 1.140
*/

public static void main(String[] args) {

BigInteger currentLine[] = new BigInteger[10000];
BigInteger nextLine[] = new BigInteger[10000];

// set limit to 10^60
BigInteger limit = BigInteger.TEN.pow(60);
boolean finish = false;
int line = 1;

// begin with two ones
currentLine[0] = currentLine[1] = BigInteger.ONE;

// print out the first two lines
System.out.println ("1");
System.out.println ("1 1");

while (!finish) {

// for every line begin with a one
nextLine[0] = BigInteger.ONE;

// a number is the sum of its two ancestors in its previous line
for (int i = 1; i <= line; i++) {
nextLine[i] = currentLine[i].add(currentLine[i - 1]);

// calculation goes on as long we dont have a number higher than the limit
if (nextLine[i].compareTo(limit) >= 0 ) finish = true;
}
nextLine[++line] = BigInteger.ONE;

// print all lines out
for (int j = 0; j < line; j++) {
System.out.print(nextLine[j] + " ");
// System.out.print(nextLine[j] + " ");
// System.out.print(currentLine[j] + " ");
currentLine[j] = nextLine[j];
}
System.out.println ("1");
currentLine[line] = BigInteger.ONE;
}
}
}

4.

/**

* Angewandte Mathematik, SS11

* Problem: 485 - Pascal Triangle of Death

* Link: http://uva.onlinejudge.org/external/4/485.pdf

* @author Brielbeck, Daniel

* @author Weber, Georg

* @version 1.0, 05/10/2011

* Method : Ad-Hoc

* Status : Accepted

* Runtime: 1.368

*/

import java.math.BigInteger;



public class Main {

public static void main(String[] args) {

BigInteger c[] = new BigInteger[10000];

BigInteger n[] = new BigInteger[10000];

BigInteger end = BigInteger.TEN;



for (int i = 2; i <= 60; i++)

end = end.multiply(BigInteger.TEN);



c[0] = c[1] = BigInteger.ONE;

System.out.println(1);

System.out.println("1" + " " + "1");

int line = 1;

boolean stop = true;



for (; stop;) {

n[0] = BigInteger.ONE;

for (int i = 1; i <= line; i++) {

n[i] = c[i].add(c[i - 1]);

if (n[i].compareTo(end) >= 0)

stop = false;

}

n[++line] = BigInteger.ONE;



for (int i = 0; i < line; i++) {

System.out.print(n[i] + " ");

c[i] = n[i];

}

System.out.println(1);

c[line] = BigInteger.ONE;

}

}

}



------------------------------

1.

package problemSetVolumes.volume004;

import java.math.BigInteger;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 485 - Pascal's Triangle of Death
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=426
*
* @author Siegfried Ippisch
* @version 1.0
*
* Method : -
* Status : Accepted
* Runtime: 1.232
*/
public class PascalsTriangleOfDeath {

public static void main(String[] arsg){
BigInteger max = new BigInteger("1000000000000000000000000000000000000000000000000000000000000");
System.out.println("1");
BigInteger[] line = new BigInteger[]{BigInteger.ONE,BigInteger.ONE};
print(line);

while(true){
BigInteger[] nextLine = new BigInteger[line.length+1];
nextLine[0] = BigInteger.ONE;
for(int i=1; i<line.length; i++)
nextLine[i] = line[i-1].add(line[i]);
nextLine[line.length] = BigInteger.ONE;
print(nextLine);
line = nextLine;
if(line[line.length/2].compareTo(max) > 0)
break;
}
}

public static void print(BigInteger[] array){
String s = ""+array[0];
for(int i=1; i<array.length; i++)
s+=" "+array[i];
System.out.println(s);
}

}


2.

package acm_485_pascals_triangle_of_death;

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

/**
* FWP, Ausgew¦hlte Probleme aus dem ACM Programming Contest, SS10
* Problem: acm_485_pascals_triangle_of_death
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&page=show_problem&category=&problem=426
*
* @author Martin Lambeck
* @version 1.0, 18.08.2010
*
* Method : bigint
* Status : Accepted
* Runtime: 1.572
*/


public class Main
{
public static void main (String...args)
{
ArrayList<BigInteger> al = new ArrayList<BigInteger>(10);

BigInteger max = new BigInteger("1000000000000000000000000000000000000000000000000000000000000");
System.out.println("1");

al.add(BigInteger.ONE);
//al.add(BigInteger.valueOf(2));
//al.add(BigInteger.ONE);

for (int i = 0; ; i++)
{
ArrayList<BigInteger> al2 = new ArrayList<BigInteger>(10);

al2.add(BigInteger.ONE);


System.out.print("1 ");

for (int j = 1; j < al.size(); j++)
{
al2.add(al.get(j-1).add(al.get(j)));
System.out.print(al2.get(al2.size()-1) + " ");

}

System.out.println("1");

if (al2.get(al2.size() / 2).compareTo(max) > 0)
return;

al2.add(BigInteger.ONE);
al = al2;
}
}
}