cf509A Maximum in Table

时间:2023-02-03 18:57:22
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 &num;289 &lpar;Div&period; 2&comma; ACM ICPC Rules&rpar; A&period; Maximum in Table【递推】

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

  2. 递推水题 Codeforces Round &num;289 &lpar;Div&period; 2&comma; ACM ICPC Rules&rpar; A&period; Maximum in Table

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

  3. codeforces水题100道 第十八题 Codeforces Round &num;289 &lpar;Div&period; 2&comma; ACM ICPC Rules&rpar; A&period; Maximum in Table &lpar;brute force&rpar;

    题目链接: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 &num;289 Div 2

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

随机推荐

  1. Usaco&ast;Monthly Expense

    Description Farmer John是一个令人惊讶的会计学天才,他已经明白了他可能会花光他的钱,这些钱本来是要维持农场每个月的正常运转的.他已经计算了他以后N(1<=N<=100 ...

  2. JS 之Blob 对象类型

    原文 http://blog.csdn.net/oscar999/article/details/36373183 什么是Blob? Blob 是什么? 这里说的是一种Javascript的对象类型. ...

  3. NodeJS系列~目录

    回到占占推荐博客索引 Node.js官网对它的阐述 Node.js is a platform built on Chrome's JavaScript runtime for easily buil ...

  4. PHP 获取网上文件内容

    <?php $ch = curl_init("http://game.qq.com/comm-htdocs/js/game_area/moba_server_select.js&quo ...

  5. NSArray 迭代

    NSObject *obj=[[NSObject alloc]init];        NSArray *array=[[NSArray alloc] initWithObjects:@" ...

  6. 关于 Unity NavMesh 数据的导出和使用

    上周的工作重点转移到服务器寻路上来,刚刚做完没几天,总结一下,当时团队讨论的结果是使用 Unity 原生的 NavMesh 系统,然后将数据导出到服务器使用.我最初的思路是将导出的网格加载到服务器后, ...

  7. hibernate 大对象类型hibernate制图

    基础知识: 在 Java 在, java.lang.String 它可以用来表示长串(超过长度 255), 字节数组 byte[] 可用于存放图片或文件的二进制数据. 此外, 在 JDBC API 中 ...

  8. Nginx:413 Request Entity Too Large解决

    最近在做给博客添加上传PDF的功能,但是在测试上传文件的过程中遇到了413 Request Entity Too Large错误.不过这个无错误是很好解决的,这个错误的出现是因为上传的文件大小超过了N ...

  9. h5与c3权威指南笔记--css3新属性选择器

    [att*=val] 选择所有att属性值中包含val的.只要包含val值,不论val值在属性值的前面还是中间还是后面~ <style> div[class*=div]{ color: r ...

  10. Android跳转各种系统设置界面-总结

    来自:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2017/0921/8536.html View btn1 = this.findVi ...