CF509A.Maximum in Table
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An n × n table a is defined as follows:
- The first row and the first column contain ones, that is: a__i, 1 = _a_1, i = 1 for all i = 1, 2, ..., n.
- Each of the remaining numbers in the table is equal to the sum of the number above it and the number to the left of it. In other words, the remaining elements are defined by the formula a__i, j = a__i - 1, j + a__i, j - 1.
These conditions define all the values in the table.
You are given a number n. You need to determine the maximum value in the n × n table defined by the rules above.
定义一个 n×n 的表格 a 如下:
- 第一行和第一列均为 1,即:对所有 i=1,2,…,n,有 ai,1=a1,i=1;
- 表格中其余每个数均等于其上方的数与左方的数之和。换言之,其余元素由公式 ai,j=ai−1,j+ai,j−1 定义。
上述条件唯一确定了表格中的所有数值。
给定一个正整数 n,你需要求出按上述规则定义的 n×n 表格中的最大值。
输入格式
The only line of input contains a positive integer n (1 ≤ n ≤ 10) — the number of rows and columns of the table.
输入仅包含一行,一个正整数 n(1 ≤ n ≤ 10)—— 表格的行数与列数。
输出格式
Print a single line containing a positive integer m — the maximum value in the table.
输出一行,包含一个正整数 m —— 表格中的最大值。
输入输出样例
输入#1
1
输出#1
1
输入#2
5
输出#2
70
说明/提示
In the second test the rows of the table look as follows:
{1, 1, 1, 1, 1},
{1, 2, 3, 4, 5},
{1, 3, 6, 10, 15},
{1, 4, 10, 20, 35},
{1, 5, 15, 35, 70}.
在第二个测试中,表格的各行如下所示:
{1, 1, 1, 1, 1},
{1, 2, 3, 4, 5},
{1, 3, 6, 10, 15},
{1, 4, 10, 20, 35},
{1, 5, 15, 35, 70}.
输入解题思路,AI测评打分。不知道怎么写?