P21951 [GeeksforGeeks] Recursive sequence1611
普及-
题目描述

A function f is defined as follows F(N)= (1) +(23) + (456) ... N. Given an integer N the task is to print the F(N)th term.
Example 1:
Input: N = 5
Output: 365527
Explaination: F(5) = 1 + 2
3 + 456 + 78910
+ 11
121314*15 = 365527.
Your Task:
You do not need to readd input or print anything. Your task is to complete the function sequence() which takes N as input parameter and returns the value of F(N).
Expected Tiime Complexity: O(N^{2})
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10

输入格式

见题面

输出格式

见题面

样例输入
N = 5
样例输出
366527