A. Maximum in Table
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

An n × n table a is defined as follows:

  • The first row and the first column contain ones, that is: ai, 1 = a1, 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 ai, j = ai - 1, j + ai, 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.

Input

The only line of input contains a positive integer n (1 ≤ n ≤ 10) — the number of rows and columns of the table.

Output

Print a single line containing a positive integer m — the maximum value in the table.

Sample test(s)
input
1
output
1
input
5
output
70
Note

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,递推求最后一个数。
【代码】:

#include <bits/stdc++.h>
using namespace std; const int INF=0x3f3f3f3f;
#define LL long long int a[][],n,ma;
int main()
{
cin>>n;
for(int i=;i<=n;i++)
a[i][]=a[][i]=; for(int i=;i<=n;i++)
{
for(int j=;j<=n;j++)
{
a[i][j]=a[i-][j]+a[i][j-];
}
}
cout<<a[n][n]<<endl;
return ;
}

傻逼递推求最大

Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table【递推】的更多相关文章

  1. codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...

  2. 递推水题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table

    题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include ...

  3. Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和

    E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  4. 贪心 Codeforces Round #289 (Div. 2, ACM ICPC Rules) B. Painting Pebbles

    题目传送门 /* 题意:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles, 使得任意两个piles,用颜色c填充的pebbles数量 ...

  5. Codeforces Round #622 (Div. 2) B. Different Rules(数学)

    Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...

  6. Codeforces Round #289 Div 2

    A. Maximum in Table 题意:给定一个表格,它的第一行全为1,第一列全为1,另外的数满足a[i][j]=a[i-1][j]+a[i][j-1],求这个表格中的最大的数 a[n][n]即 ...

  7. Codeforces Round #554 (Div. 2) F2. Neko Rules the Catniverse (Large Version) (矩阵快速幂 状压DP)

    题意 有nnn个点,每个点只能走到编号在[1,min(n+m,1)][1,min(n+m,1)][1,min(n+m,1)]范围内的点.求路径长度恰好为kkk的简单路径(一个点最多走一次)数. 1≤n ...

  8. Codeforces Round #116 (Div. 2, ACM-ICPC Rules)

    Codeforces Round #116 (Div. 2, ACM-ICPC Rules) 代码 Codeforces Round #116 (Div. 2, ACM-ICPC Rules) A. ...

  9. Codeforces Round #223 (Div. 2) A

    A. Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard i ...

随机推荐

  1. java中封装的概念

    封装(Encapsulation)是类的三大特性之一, 就是将类的状态信息隐藏在类的内部,不允许外部程序直接访问, 而是通过该类提供的方法来实现对隐藏信息的操作和访问. 简而言之,就是隐藏内部实现,提 ...

  2. ffifdyop

    题目地址:http://www.shiyanbar.com/ctf/2036 后台登陆 上来看到这个界面,果断先看一波源代码. 看到是拼接字符串进行sql查询,就想到了注入了. 但是很不幸的是md5( ...

  3. DWZ(J-UI)之路:错误

    1:关于左侧点击会把右边小窗口替换掉,导致右边永远只有一个小窗口. 方法:因为缺少了这个—— <li><a href="/admin/demo/index" ta ...

  4. Python——数据类型之list、tuple

    本篇主要内容 •  list初识 •  list元素的访问 •  list内部所有的方法 •  tuple介绍和与list用法的比较 我觉得Python里面用的最多的就是List了,感觉好强大.他能存 ...

  5. vue 自定义过度组件用法

    HTML: <div id="example-1"> <button @click="show = !show"> Toggle ren ...

  6. ALPHA(10)

    目录 组员情况 组员1(组长):胡绪佩 组员2:胡青元 组员3:庄卉 组员4:家灿 组员5:凯琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示 ...

  7. Struts1 生成Action请求的几种方式分析

    1 直接硬编码 <a href="/Lesson14_Struts1_Demo1//user/regUserDo.do">注册</a><br/> ...

  8. 2017 多校5 hdu 6093 Rikka with Number

    2017 多校5 Rikka with Number(数学 + 数位dp) 题意: 统计\([L,R]\)内 有多少数字 满足在某个\(d(d>=2)\)进制下是\(d\)的全排列的 \(1 & ...

  9. 洛谷 P2485 [SDOI2011]计算器 解题报告

    P2485 [SDOI2011]计算器 题目描述 你被要求设计一个计算器完成以下三项任务: 1.给定y.z.p,计算y^z mod p 的值: 2.给定y.z.p,计算满足xy ≡z(mod p)的最 ...

  10. [经验分享]NuGet发布自己的Dll(类库包)

    什么是Nuget Nuget是一个.NET平台下的开源的项目,它是Visual Studio的扩展.在使用Visual Studio开发基于.NET Framework的应用时,Nuget能把在项目中 ...