EUROPEAN ITERATION
We know about number systems: The Roman numerals and the alternative place-value system with a given base. For the purposes of this problem, we limit ourselves to Roman numerals with values up to 3999 MMMCMXCIX "Place value system" numbers having bases from 2 (with possible symbols 0, 1) through 36 (with possible symbols 0, 1, ..., 9, A, ... ,Z) Consider the following procedure: Accept a natural number N (in base 10). If N lies in the closed interval [1,3999], i.e. between 1 and 3999 (both inclusive), convert N to R , its Roman numeral representation; else output N as the result and stop. Identify the base in which the value of R, now considered to be in "place value system", is least and calculate its value in base 10, replacing N with this value. Repeat from step 2. Constraints 1 <= N <= 3999 Input Format A single Integer N . Output Converted N Test Case Example Input 1 Output 45338950 Explanation The procedure g...