Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table【递推】
2 seconds
256 megabytes
standard input
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.
The only line of input contains a positive integer n (1 ≤ n ≤ 10) — the number of rows and columns of the table.
Print a single line containing a positive integer m — the maximum value in the table.
1
1
5
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}.
#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【递推】的更多相关文章
- 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 ...
- 递推水题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table
题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include ...
- 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 ...
- 贪心 Codeforces Round #289 (Div. 2, ACM ICPC Rules) B. Painting Pebbles
题目传送门 /* 题意:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles, 使得任意两个piles,用颜色c填充的pebbles数量 ...
- Codeforces Round #622 (Div. 2) B. Different Rules(数学)
Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...
- 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]即 ...
- 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 ...
- 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. ...
- 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 ...
随机推荐
- Jenkins拾遗--第一篇(安装Jenkins)
起因 近期由于工作需要做起了起了jenkins的维护.不做不知道,一搞发现里边全是小坑.两个月弄了一身泥.曾经小瞧了它,但是发现其实要弄好它不是那么容易的.有句知名的话"没有总结就没有提高. ...
- elk-logstash: window下指定jdk目录
\bin\logstash.bat文件中, SETLOCAL的后面,CALL "%SCRIPT_DIR%\setup.bat" 的前面增加一行: @echo off SETLOCA ...
- CodeForces-757B Bash's Big Day
题目链接 https://vjudge.net/problem/CodeForces-757B 题目 Description Bash has set out on a journey to beco ...
- [oldboy-django][2深入django]点击刷新验证码
# 点击更新验证码,只要重新在发送一个请求即可 <img src="/check_code/" onclick="updateCode(this);" w ...
- php 数据库内容增删改查----增
首先,建立一个主页面(crud.php) <!DOCTYPE html> <html lang="en"> <head> <meta ch ...
- ocrosoft Contest1316 - 信奥编程之路~~~~~第三关 问题 C: 挂盐水
http://acm.ocrosoft.com/problem.php?cid=1316&pid=2 题目描述 挂盐水的时候,如果滴起来有规律,先是滴一滴,停一下:然后滴二滴,停一下:再滴三滴 ...
- [GDOI2016] 疯狂动物园 [树链剖分+可持久化线段树]
题面 太长了,而且解释的不清楚,我来给个简化版的题意: 给定一棵$n$个点的数,每个点有点权,你需要实现以下$m$个操作 操作1,把$x$到$y$的路径上的所有点的权值都加上$delta$,并且更新一 ...
- [BZOJ4205][FJ2015集训] 卡牌配对 [建图+最大流]
题面 这是bzoj权限题,题面可以去下面的离线题库找 离线4205,只有题面,不能提交 思路 二分图匹配 这道题模型显然就是个二分图匹配嘛 那我们两两判断一下然后连边匹配.....就只有30分了 因为 ...
- AE中实现Control中的各种图形工具的方法
添加命名空间 using ESRI.ArcGIS.SystemUI;using ESRI.ArcGIS.Controls; A类:前面有Controls 后面有tool的工具都可以用同一类的代码实现( ...
- code forces 996BWorld Cup
B. World Cup time limit per test 1 second memory limit per test 256 megabytes input standard input o ...