CF57C.Array
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Chris the Rabbit has been interested in arrays ever since he was a child. At the moment he is researching arrays with the length of n, containing only integers from 1 to n. He is not good at math, that's why some simple things drive him crazy. For example, yesterday he grew keen on counting how many different beautiful arrays there are. Chris thinks that an array is beautiful if it meets one of the two conditions:
- each elements, starting from the second one, is no more than the preceding one
- each element, starting from the second one, is no less than the preceding one
Having got absolutely mad at himself and at math, Chris came to Stewie and Brian to ask them for help. However, they only laughed at him and said that the answer is too simple and not interesting. Help Chris the Rabbit to find the answer at last.
兔子克里斯从小就对数组感兴趣。目前,他正在研究长度为 n 的数组,且数组中仅包含从 1 到 n 的整数。他不擅长数学,因此一些简单的问题就足以让他抓狂。例如,昨天他突然热衷于计算有多少个不同的“优美数组”。克里斯认为一个数组是优美的,当且仅当它满足以下两个条件之一:
- 从第二个元素开始,每个元素都不大于其前一个元素;
- 从第二个元素开始,每个元素都不小于其前一个元素。
由于对自己和数学彻底崩溃,克里斯找到了斯图威和布莱恩求助。然而,他们只是嘲笑他,并称答案太简单、毫无趣味。请最终帮助兔子克里斯找到这个答案。
输入格式
The single line contains an integer n which is the size of the array (1 ≤ n ≤ 105).
单行包含一个整数 n,表示数组的大小(1 ≤ n ≤ 105)。
输出格式
You must print the answer on a single line. As it can be rather long, you should print it modulo 1000000007.
你必须在一行内输出答案。由于答案可能很长,你需要输出其对 1000000007 取模的结果。
输入输出样例
输入#1
2
输出#1
4
输入#2
3
输出#2
17
输入解题思路,AI测评打分。不知道怎么写?