Roman NumeralsProblem code: CS05 |
Problem text... Many persons are familiar with the Roman numerals for relatively small numbers. The symbols i, v, x, l and c represent the decimal values 1, 5, 10, 50 and 100 respectively. To represent other values, these symbols, and multiples where necessary, are concatenated, with the smaller valued symbols written further to the right. For example, the number 3 is represented as "iii", and the value 73 is represented as "lxxiii". The exceptions to this rule occur for numbers having units values of 4 to 9, and for tens values of 40 or 90. For these cases, the Roman numerals representations are "iv" (4), "ix" (9), "xl" (40) and "xc" (90). So the Roman numeral representations for 24,39,44,49 and 94 are xxiv, xxxix, xliv, xlix and xciv respectively. The preface of many books have pages numbered with Roman numerals, starting with "i" for the first page of the preface, and continuing in sequence. Assume books with pages having 100 or fewer pages of preface. How many i, v, x, l and c characters are required to number the pages in the preface? For example, in a five page preface we'll use the Roman numerals i, ii, iii, iv and v, meaning we need 7 i characters and 2 v characters.
Input
Input description... The input will consists of a sequence of integers in the range 1 to 100, terminated by a zero. For each integer, excepts the final zero, determine the number of different types of characters needed to number the prefix pages with Roman numerals
Output
Output description... For each integer in the input, write one line containing the five counts in the order i, v, x, l, c.
Example
Input: 2 20 99 0 Output: 3 0 0 0 0 28 10 14 0 0 140 50 150 50 10
| Author: | rushikesh30 |
| Date Added: | 14-02-2010 |
| Time Limit: | 10 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Please check whether
Please check whether submission is opened or not . I am getting 'This problem can't be tested Yet' error message.
for now try other
for now try other problems.Will soon correct the problem
those who have registered on
those who have registered on sparx site mail ur team name to code@sparx.org.in
i'm getting a runtime
Hi mandar you can resubmit
Hi mandar you can resubmit your code now.
cant we submit now?
cant we submit now?