1. 程式人生 > >Codeforces Round #493 (Div. 2) D. Roman Digits

Codeforces Round #493 (Div. 2) D. Roman Digits

Let's introduce a number system which is based on a roman digits. There are digits IVXL which correspond to the numbers 11551010and 5050 respectively. The use of other roman digits is not allowed.

Numbers in this system are written as a sequence of one or more digits. We define the value of the sequence simply as the sum of digits in it.

For example, the number XXXV evaluates to 3535 and the number IXI — to 1212.

Pay attention to the difference to the traditional roman system — in our system any sequence of digits is valid, moreover the order of digits doesn't matter, for example IX means 1111, not 99.

One can notice that this system is ambiguous, and some numbers can be written in many different ways. Your goal is to determine how many distinct integers can be represented by exactly

 nn roman digits IVXL.