1. 

/**
* Angewandte Mathematik SS09
* ACM Problem 386 - Perfect Cubes
*
* @author M. Stadler
* @author J. M�ller
* @version 1.0
*
* Status : Accepted
* Runtime: 0.510
*/



public class Main {


public static void main(String[] args) {
int i;
int a, b, c, d, rem, rem2;
int[] cube = new int[201];

for(i = 0; i <= 200; i++)
cube[i] = i*i*i;

for(a=6; a<=200; a++)
for(b=2; b<a; b++) {
rem=cube[a]-cube[b];
for(c=b; cube[c]<rem; c++) {
rem2=rem-cube[c];
for(d=c; cube[d]<=rem2; d++) {
if(cube[d]==rem2){
System.out.println("Cube = " + a + ", Triple = (" + b + "," + c + "," + d + ")");
}
}
}
}

}
}

2.

/**
* 386 - Perfect Cubes
*
* Studiengruppe: IFB2C
*
* Robert Reichart
* Elvin Uzeirovic
* Martin Pesl
*
* Run Time Submission Date
* 0.520 2009-04-22 14:22:54
*/

public class PerfectCubes {

public static void main(String[] args) {
int maxzahl = 200;
int[] Array = fill(maxzahl);

int rem;
int rem2;
int i, a, b, c, d;

for (a = 6; a <= 200; a++) {
for (b = 2; b < a; b++) {
rem = Array[a] - Array[b];
for (c = b; Array[c] < rem; c++) {
rem2 = rem - Array[c];
for (d = c; Array[d] <= rem2; d++) {
if (Array[d] == rem2) {
System.out.println("Cube = " + a
+ ", Triple = (" + b + "," + c + "," + d + ")");
}

}
}
}
}
}



public static int[] fill(int maxzahl) {
int[] ret = new int[maxzahl + 1];
for (int i = 0; i < maxzahl + 1; i++) {
ret[i] = (int) Math.pow(i, 3);
}
return ret;
}
}