【codeforces 128C】Games with Rectangle
【题目链接】:http://codeforces.com/problemset/problem/128/C
【题意】
让你一层一层地在n*m的网格上画k个递进关系的长方形;(要求一个矩形是包含在另外一个矩形里面的);
问你有多少种方案;
【题解】
可以发现方案等同于在长和宽上各取2*k条直线的方案;
即C(n−1,2∗k)∗C(m−1,2∗k)
这样在整个n*m的方格上,就能取出k个矩形啦
这里之所以要减1,是因为两端不能算;(不能触碰到边缘上的点);
预处理出组合数就可以了;
会爆int;
【Number Of WA】
1
【完整代码】
#include <bits/stdc++.h>
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define LL long long
using namespace std;
const int N = 2100;
const LL MOD = 1e9+7;
LL c[N][N],n,m,k;
int main(){
rep1(i,1,2000){
c[i][0] = c[i][i] = 1;
}
rep1(i,1,2000){
rep1(j,1,i-1)
c[i][j] = (c[i-1][j]+c[i-1][j-1])%MOD;
}
cin >>n >> m >>k;
cout << c[n-1][2*k]*c[m-1][2*k]%MOD << endl;
return 0;
}
【codeforces 128C】Games with Rectangle的更多相关文章
- 【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 630E】A rectangle
[题目链接]:http://codeforces.com/problemset/problem/630/E [题意] 给你一个矩形的区域; 然后让你统计这个矩形区域内,有多少个正六边形. [题解] 规 ...
- 【45.65%】【codeforces 560B】Gerald is into Art
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【25.64%】【codeforces 570E】Pig and Palindromes
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【84.62%】【codeforces 552A】Vanya and Table
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 754B】 Ilya and tic-tac-toe game
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 758C】Unfair Poll
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 546D】Soldier and Number Game
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 752F】Santa Clauses and a Soccer Championship
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
随机推荐
- 01 C#基础
第一天 .net平台(中国移动互联网平台): .net框架(信号塔): CLR(公共语言运行时) .Net类 库 我们使用的语言是——C# 2.解决方案项目与类的关系: 解决方案:公司 项目:部门 类 ...
- [BZOJ3438][洛谷P1361]小M的作物
题目大意:有A.B两个集合和n个物品,每个物品只能放在一个集合里.每个物品放在不同集合内能获得不同价值.有一些物品,如果它们同时放在一个集合内,则会产生新的价值(A和B中都有且不一定相同(c1和c2) ...
- [JZOJ]100047. 【NOIP2017提高A组模拟7.14】基因变异
21 世纪是生物学的世纪,以遗传与进化为代表的现代生物理论越来越多的 进入了我们的视野. 如同大家所熟知的,基因是遗传因子,它记录了生命的基本构造和性能. 因此生物进化与基因的变异息息相关,考察基因变 ...
- [学习笔记] CS131 Computer Vision: Foundations and Applications:Lecture 3 线性代数初步
向量和矩阵 什么是矩阵/向量? Vectors and matrix are just collections of ordered numbers that represent something: ...
- C++操作符重载总结operator(小结 更新ing)
操作符重载一个原则是:被操作的数据类型中 至少有一个是自定义的类型(使用class定义类),如果被操作的变量都是基本类型,那么就不能定义操作符重载. 1.如果重载了new,则必须重载delete,因为 ...
- debian 9 安装无线网卡
#添加源 echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free" >> ...
- ansible组件 Ad-Hoc
ad hoc ---临时的,在ansible里需要快速执行,并不用保存命令的执行方式 简单命令 playbook 复杂命令 EXAMPLES: - name: install the late ...
- python_元组、字典
1.元组无法修改,只能索引2.只有两种方法 count 和 indexnames = ("Alex","jack")print(names.count(&quo ...
- [AngularJS]Chapter 2 剖析安哥拉JS应用程序
不同于普通的框架,你可以从中选择你想用的方法.在anjular中是不同组件写作工作的.这章中,你会看到anjular中基本的组成部分并且理解他们是如何协同工作的.很多组件会在以后的章节中详细讲解.[开 ...
- IntelliJ IDEA启动spring boot项目出现Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
IntelliJ IDEA启动spring boot项目出现Failed to start component [StandardEngine[Tomcat].StandardHost[localho ...