1. Erste Version: Java, Evgeni Pavlidis


/**
* ACM programming Contest WS 08/09
* UVa Status: accepted
* Run Time: 0.160
* @author Evgeni Pavlidis evgenipavlidis@yahoo.de
*/
import java.util.*;
import java.io.*;

class Main extends Thread {

private Scanner input = new Scanner(System.in);

public static void main(String... args)
{
(new Main()).start();
}

void calcPerfection(int n)
{
String category = null;
int sum = 0;

for(int i = 1; i < n; i++)
if(n%i == 0)
sum += i;

if(sum == n)
category = "PERFECT";
else if(sum < n)
category = "DEFICIENT";
else
category = "ABUNDANT";


System.out.printf("%5d %s\n", n, category);
}

public void run()
{
System.out.println("PERFECTION OUTPUT");
while(input.hasNextInt())
{
int n = input.nextInt();
if(n == 0)
{
System.out.println("END OF OUTPUT");
System.exit(0);
}
calcPerfection(n);
}
}
}