time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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, 1010and 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.
Input
The only line of the input file contains a single integer nn (1≤n≤1091≤n≤109) — the number of roman digits to use.
Output
Output a single integer — the number of distinct integers which can be represented using nn roman digits exactly.
Examples
input
Copy
1
output
Copy
4
input
Copy
2
output
Copy
10
input
Copy
10
output
Copy
244
Note
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).
想了半天没有点思路,然后百度题解发现是打表做法,于是我也打表,1,10,20,35,56,83,116,155,198,244,292
打出11个没有发现任何规律,再看一眼题解,原来是前10是用表输出,后面的都是等差数列,等差值为49,那我继续打表:341,390,439,488,537,好像真是这个规律,看来以后打表多打几个,可能前面是依靠表直接输出。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+10;
int vis[N],n;
int a[]={0,4,10,20,35,56,83,116,155,198,244,292};
int main()
{
cin>>n;
if(n<=10)
{
printf("%d\n",a[n]);
return 0;
}
ll ans=292+1ll*(n-11)*49;
printf("%lld\n",ans);
}