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}.

这题不需要解释了吧

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<ctime>
#include<iomanip>
#define LL long long
#define inf 0x7ffffff
#define N 200010
using namespace std;
inline LL read()
{
LL x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
LL a[11][11];
int n;
int main()
{
n=read();
a[0][1]=1;
for (int i=1;i<=10;i++)
for (int j=1;j<=10;j++)
a[i][j]=a[i-1][j]+a[i][j-1];
printf("%lld\n",a[n][n]);
}

cf509A Maximum in Table的更多相关文章

  1. Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table【递推】

    A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

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

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

  3. 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 ...

  4. 【codeforces 509A】Maximum in Table

    [题目链接]:http://codeforces.com/contest/509/problem/A [题意] 给你一个递推式f[i][j] = f[i-1][j]+f[i][j-1]; 让你求f[i ...

  5. ORACLE数据库的限制

    ORACLE数据库最多可以拥有多少个表空间(Tablespace)?数据库最多拥有多少个数据文件(Database files).数据库的数据文件最大可以多大?遇到这些问题只能查询官方文档,人的记忆能 ...

  6. sqlplus使用(二)

    详见SQL*Plus® User's Guide and Reference Release 11.2   5 Using Scripts in SQL*Plus   1.定义环境变量 _EDITOR ...

  7. Canu Parameter Reference(canu参数介绍)

    链接:Canu Parameter Reference To get the most up-to-date options, run canu -options The default values ...

  8. Swift 里 Set(一)辅助类型

    _UnsafeBitset  是一个固定大小的 bitmap,用来确定指定位置是否有元素存在. HashTable  具体的 hash 碰撞算法在HashTable里实现,目前使用的是简单的开放地 ...

  9. 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]即 ...

随机推荐

  1. hdu 3037 Saving Beans(组合数学)

    hdu 3037 Saving Beans 题目大意:n个数,和不大于m的情况,结果模掉p,p保证为素数. 解题思路:隔板法,C(nn+m)多选的一块保证了n个数的和小于等于m.可是n,m非常大,所以 ...

  2. [转] Makefile中调用Shell

    1.在Makefile中只能在target中调用Shell脚本,其他地方是不能输出的.比如如下代码就是没有任何输出: VAR="Hello" echo "$(VAR)&q ...

  3. js禁止浏览器滚屏方法

    在有些需求中需要对页面进行限制页面的查看权限,阻止用户滚动浏览器.那么我们就要禁止鼠标的滚动事件,并且如果浏览器的滚动事件一旦触发我们就将滚动条重置为0就可以了.以下是具体代码: //出现滚动值立马归 ...

  4. ·数据库基本内容回顾-day16.06.30

    一. 模式的定义和删除  ---创建了一个模式,就创建了一个数据库命名空间,一个框架.cascade.restrict create schema<模式名> authorization & ...

  5. ListActivity ListView 使用 介绍 用法

    ListActivity简单的说就是ListView和Activity的结合,跟ListView和Activity组合实现的没有什么很大的差别,主要是比较方便. 在实现时,要注意: 1.一般情况,Li ...

  6. 安装VS2013的离线MSDN帮助文档

    作为vs的初学者,安装帮助文档有利于快速掌握.net的基本语法,对于摸索学习的同学帮助很大. VS2013和VS2012的帮助文档目前为止还是一样 下面是下载地址    http://www.micr ...

  7. mockito学习

    mockito学习 写一个测试用例,如果在测试类上面添加了注解@RunWith(SpringJUnit4ClassRunner.class),必须添加@ContextConfiguration(&qu ...

  8. JQuery图片轮换 nivoSlider图片轮换

    效果图: 第一步:添加引用 <script src="jquery-ui-1.9.2.custom.min.js" type="text/javascript&qu ...

  9. java中的final, finally, finalize的区别

    final修饰符(关键字),如果一个类被声明为final,意味着它不能再派生出新的子类,不能作为父类被继承.因此一个类不能既被声明为abstract的,又被声明为final的.将变量或方法声明为fin ...

  10. WCF理论 【转载】

    原文地址:http://blog.itpub.net/23109131/viewspace-661613/ WCF是什么? WCF是"Windows Communication Founda ...