Roman Digits(打表找规律)

Roman Digits

Let’s introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50

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 35
and the number IXI — to 12

.

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 11
, not 9

.

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 n

roman digits I, V, X, L.

Input

The only line of the input file contains a single integer n

(1≤n≤109

) — the number of roman digits to use.

Output

Output a single integer — the number of distinct integers which can be represented using n

roman digits exactly.

Examples
Input

1

Output

4

Input

2

Output

10

Input

10

Output

244

Note

In the first sample there are exactly 4

integers which can be represented — I, V, X and L.

In the second sample it is possible to represent integers 2
(II), 6 (VI), 10 (VV), 11 (XI), 15 (XV), 20 (XX), 51 (IL), 55 (VL), 60 (XL) and 100 (LL).

题意:

有一种新的数字系统,在这个数字系统中所有的书都有着四个字母组成 I, V, X, L,他们分别代表 1 5 10 50。组成数的大小就是这几个字母值的代数和(与字母顺序无关),问,从这4中字母中选择n个,能表示多少个不同的数字。

分析:

打表找规律
从第11项开始,后面就是以49为公差的等差数列

code:

#include <bits/stdc++.h>
using namespace std;
const long long ans[12] = {0,4,10,20,35,56,83,116,155,198,244,292};
int main(){
    long long n;
    cin >> n;
    if(n <= 11)
        cout << ans[n] << endl;
    else
        cout << ans[11] + (n - 11) * 49 << endl;
    return 0;
}4
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值