boris-vlasenko

перевод в римскую систему счисления2

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