Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R=['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I', 'I', 'I', 'I']
- A=[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 3, 2, 1]
- a = int(input())
- res = ''
- i = 0
- while a:
- while a >= A[i]:
- a -= A[i]
- res += R[i]
- i += 1
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment