1. Erste Version: JAVA, Evgeni Pavlidis


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

class Main {

public static void main(String... args)
{
BigInteger b;
Scanner scanner = new Scanner(System.in);
int n;

while((n = scanner.nextInt()) != 0)
{
b = BigInteger.ONE;

for(int i = 2; i <= n; i++)
b = b.multiply(BigInteger.valueOf(i));

printStatistic(n, b);
}

System.exit(0);

}

private static void printStatistic(int n, BigInteger b)
{
int[] statistic = new int[10];
for(int i = 0; i < 10; i++)
statistic[i] = 0;

String number = b.toString();

for(int i = 0; i < number.length(); i++)
{
statistic[number.charAt(i) - 48]++;
}

System.out.printf("%d! --%n", n);
for(int i = 0; i <= 9; i++)
{
if(i == 5)
System.out.println();
System.out.printf(" (%d)%4d", i, statistic[i]);
}
System.out.println();
}
}