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. c++对象模型之Data布局

    Data语意学 class X{}; class Y : publicvirtual X {}; class Z : publicvirtual X {}; class A : publicY, pu ...

  2. HDU 5266 pog loves szh III (线段树+在线LCA转RMQ)

    题目地址:HDU 5266 这题用转RMQ求LCA的方法来做的很easy,仅仅须要找到l-r区间内的dfs序最大的和最小的就能够.那么用线段树或者RMQ维护一下区间最值就能够了.然后就是找dfs序最大 ...

  3. 那些年,学swift踩过的坑

    最近在学swift,本以为多是语法与oc不同,而且都是使用相同的cocoa框架,相同的API,但是或多或少还是有些坑在里,为了避免以后再踩,在这里记下了,以后发现新的坑,也会慢慢在这里加上 [TOC] ...

  4. 使用MySQL的LAST_INSERT_ID--转

    LAST_INSERT_ID 自动返回最后一个 INSERT 或 UPDATE 操作为 AUTO_INCREMENT 列设置的第一个发生的值. 参考这里 The ID that was generat ...

  5. [转] 关于SIGPIPE导致的程序退出

    PS: 如果服务器程序不忽略SIGPIPE,在某些时候TCP writer收到这个信号,会导致进程退出 The rule that applies is: When a process writes ...

  6. 使用truncate命令清空当前用户所有表的所有数据

    --批量清空当前用户所有表的所有数据 declarev_sql varchar2(2000) ;CURSOR cur is select table_name from user_tables ord ...

  7. Debian耳机声音问题

    Debian耳机声音问题 关于Debian声音问题 debian testing基本系统安装无声音问题解决 耳机声音问题 之前耳机声音一直正常,使用部分软件更改声卡设置后,计算机可以播放外音,但是耳机 ...

  8. 【网络流#5】UVA 11082 最大流

    网络流题目最有意思的地方就是构图了,毕竟套模板每个人都会的 现在有一个矩阵,已知前i行元素之和a[i](1<=i<=n),前j列元素之和b[j](1<=j<=m),求一个可行的 ...

  9. 使用socket实现聊天功能

    public class Service { //服务器 public static void main(String[] args) { ServerSocket serverSocket=null ...

  10. mysql source命令导入sql文件效率分析和索引整理

    Query OK, 24918 rows affected (0.90 sec)Records: 24918  Duplicates: 0  Warnings: 0 Query OK, 24923 r ...