CF997B.Roman Digits

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 11, 55, 1010 and 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 I, V, X, L.

我们来介绍一种基于罗马数字的数制系统。该系统包含数字 I、V、X、L,分别对应数值 11、55、1010 和 5050。不允许使用其他罗马数字。

该系统中的数由一个或多个数字组成的序列表示。我们定义该序列的值为其所含所有数字对应数值的和。

例如,数 XXXV 的值为 3535,而数 IXI 的值为 1212。

请注意,这与传统的罗马数字系统不同:在本系统中,任意数字序列均合法;此外,数字的顺序无关紧要,例如 IX 表示 1111,而非 99。

可以注意到,该系统是有歧义的,某些整数可以用多种不同的方式表示。你的任务是:确定恰好使用 nn 个罗马数字(I、V、X、L 中的若干个,总数为 nn) 能表示出多少个互不相同的整数。

输入格式

The only line of the input file contains a single integer nn (1≤n≤1091 \le n \le 10^9) — the number of roman digits to use.

输入文件的唯一一行包含一个整数 nn(1≤n≤1091 \le n \le 10^9)——表示要使用的罗马数字个数。

输出格式

Output a single integer — the number of distinct integers which can be represented using nn roman digits exactly.

输出一个整数——恰好使用 nn 个罗马数字所能表示的不同整数的个数。

输入输出样例

  • 输入#1

    1

    输出#1

    4
  • 输入#2

    2

    输出#2

    10
  • 输入#3

    10

    输出#3

    244

说明/提示

In the first sample there are exactly 44 integers which can be represented — I, V, X and L.

In the second sample it is possible to represent integers 22 (II), 66 (VI), 1010 (VV), 1111 (XI), 1515 (XV), 2020 (XX), 5151 (IL), 5555 (VL), 6060 (XL) and 100100 (LL).

在第一个样例中,恰好有 44 个整数可以被表示——即 I、V、X 和 L。

在第二个样例中,可以表示的整数有 22(II)、66(VI)、1010(VV)、1111(XI)、1515(XV)、2020(XX)、5151(IL)、5555(VL)、6060(XL)和 100100(LL)。

输入解题思路,AI测评打分。不知道怎么写?

首页