【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][j]的最大值;
【题解】
傻逼题
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) cin >> x
#define pri(x) cout << x
#define ms(x,y) memset(x,y,sizeof x)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 20;
LL a[N][N],ans;
int n;
int main()
{
//freopen("F:\\rush.txt","r",stdin);
ios::sync_with_stdio(false);
rei(n);
rep1(i,1,n)
a[i][1]=a[1][i]=1;
rep1(i,2,n)
rep1(j,2,n)
a[i][j] = a[i-1][j]+a[i][j-1];
ans = 1;
rep1(i,1,n)
rep1(j,1,n)
ans = max(ans,a[i][j]);
pri(ans<<endl);
//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}
【codeforces 509A】Maximum in Table的更多相关文章
- 【35.29%】【codeforces 557C】Arthur and Table
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【84.62%】【codeforces 552A】Vanya and Table
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【Codeforces 140A】New Year Table
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 算出来每个盘子要占用多少角度. 然后乘n看看是不是小于等于2π就好 (精度最好定在1e-7) [代码] #include <bits/s ...
- 【Codeforces 375B】Maximum Submatrix 2
[链接] 我是链接,点我呀:) [题意] 如果任意行之间可以重新排序. 问你最大的全是1的子矩阵中1的个数 [题解] 设cnt[i][j] 表示(i,j)这个点往右连续的1的个数 我们枚举列j 然后对 ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 765C】Table Tennis Game 2
[题目链接]:http://codeforces.com/contest/765/problem/C [题意] 枚举游戏先拿到k分的人胜; 然后两个人一个人得了a分,一个人得了b分; 问你最多可能进行 ...
- 【Codeforces 582A】 GCD Table
[题目链接] 点击打开链接 [算法] G中最大的数一定也是a中最大的数. G中次大的数一定也是a中次大的数. 第三.第四可能是由最大和次大的gcd产生的 那么就不难想到下面的算法: ...
- 【77.78%】【codeforces 625C】K-special Tables
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 【codeforces 758C】Unfair Poll
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
随机推荐
- 分享tiny4412,emmc烧录u-boot, 支持fastboot模式烧写emmc【转】
本文转载自:http://www.arm9home.net/read.php?tid-80810.html 分享tiny4412,emmc烧录u-boot, 支持fastboot模式烧写emmc ...
- bzoj 4003 [JLOI2015]城池攻占 —— 左偏树
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4003 其实蛮简单的,首先一个城市只会被其子树中的骑士经过,启发我们 dfs 序用可并堆合并子 ...
- RDA 字库制作
制作韩语字库为例: 1.韩语UNICODE 范围 TV_IDF_uni_korean.txt [01fa,] [02c6,02c7] [02c9,02ca] [02cd,02cd] [02d8,02d ...
- MySQL max_connections 总是 214 。不能设大了? max_connections = 214
MySQL max_connections 总是 214 .不能设大了? centos7 mariadb 修改 max_connections 总是214 It was indeed limits s ...
- TextMeshPro 图片字Sprite
生成 需要一个资源 右键生成 调整位置 放在目录 使用 <sprite="NumDamage" index=1><sprite="NumDam ...
- [Swift通天遁地]九、拔剑吧-(12)创建Preview-Transition图像预览界面
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 前端性能优化---减少http请求数量和减少请求资源的大小
减少http请求数量:就是资源的合并 减少http请求大小:就是资源的压缩 一.资源合并的原理: 资源不合并的缺点: 1.文件和文件之间有插入请求----请求a.js,b.js,c.js(三行 ...
- BZOJ 3798 分块打表
思路: 这题思路真是奇妙 先跑个暴力 每隔1e5打个表 块内暴力 打表程序: (开O3 15秒就跑完了) //By SiriusRen #include <bits/stdc++.h> u ...
- Java保存错误日志信息
我们平时在撸代码的时候,有时候需要将某个代码块的具体错误信息保存到数据库或文件中,以便日后方便快速的查找问题. 使用e.printStackTrace(),我们可以将信息保存在具体的变量中,然后写入数 ...
- Jquery 实现列表的显示和隐藏
本人github源码下载地址:https://github.com/liuyanpeng521/ListChange.git