1. JAVA, Peter Schnitzler

/* Problem : 344
* Author : Peter Schnitzler
* Status : AC
* Runtime : 0.06
*/


import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main
{
public static void main(String[] args) throws Exception
{
//der n'te Array speichert die Nummerale die bis zur n'ten Seite vorkamen
int letterCount [][] = new int [101][5];


for (int iter = 1; iter <= 100; iter++)
{
//0 == I , 1 == V , 2 == X , 3 == L , 4 == C
int currentLets [] = new int[5];

for (int c = 0; c < 5; c++)
{
currentLets[c] = letterCount[iter - 1][c];
}

//Einer Stelle
int temp = iter % 10;

if (temp >= 4 && temp < 9)
{
currentLets[1]++;
if (temp == 4)
{
currentLets[0]++;
}
else
{
currentLets[0] += (temp - 5);
}
}
else
{
if (temp == 9)
{
currentLets[2]++;
currentLets[0]++;
}
else
{
currentLets[0] += temp;
}
}

if (iter != 100)
{
//Zehner Stelle
temp = iter / 10;


if (temp >= 4 && temp < 9)
{
currentLets[3]++;
if (temp == 4)
{
currentLets[2]++;
}
else
{
currentLets[2] += (temp - 5);
}
}
else
{
if (temp == 9)
{
currentLets[2]++;
currentLets[4]++;
}
else
{
currentLets[2] += temp;
}
}
}
else
{
//Hundert
currentLets[4]++;
}


letterCount[iter] = currentLets;
}


//input
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String line = read.readLine();

while (true)
{
int input = Integer.parseInt(line.trim());

if (input == 0)
{
break;
}


//output
System.out.println(input + ": " + letterCount[input][0] + " i, " + letterCount[input][1] + " v, " + letterCount[input][2] + " x, " + letterCount[input][3] + " l, " + letterCount[input][4] + " c");

line = read.readLine();
}

}

}