【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 ...
随机推荐
- Linux赛车游戏 SuperTuxKart 1.0 正式发布
SuperTuxKart是一款受Mario Kart(马里奥赛车)启发并以Linux/Tux为主题的开源赛车游戏,经过12年多的开发,已经达到1.0版本.并且确定这个版本确实是一个重要的里程碑. Su ...
- python中return和print的区别(详细)
huskiesir最近在研究python哈,今天纠结一个问题,那就是return和print的区别,都是可以输出结果的,到底有啥区别呀?二话不多说,看下面的例子. #代码1: def break_wo ...
- webpack中关于require与import的区别
1.require常见使用场景: var path = require('path') var utils = require('./utils') 此时webpack会将path/utils/con ...
- Python学习笔记(4)列表
2019-02-26 列表(list):①创建方法:用‘[ ]’,将数据包括起来,数据之间用逗号隔开.②空列表:empty = []③增删改查: 1)增加: a.append()方法——将元素添加到列 ...
- How to check Open vSwitch version and supports OpenFlow version
Open vSwitch (OVS) is an open-source virtual switch, featuring programmable switch forwarding capabi ...
- 【【henuacm2016级暑期训练】动态规划专题 F】Physics Practical
[链接] 我是链接,点我呀:) [题意] 给你n个数字 让你删掉最小的数字 使得: 剩余的数字中 "最大的数字"小于等于"最小的数字*2" [题解] 把数据从小 ...
- nutch如何修改regex-urlfilter.txt爬取符合条件的链接
例如我在爬取学生在线的时候,发现爬取不到特定的通知,例如<中粮福临门助学基金申请公告>,通过分析发现原来通知的链接被过滤掉了,下面对过滤url的配置文件regex-urlfilter.tx ...
- JavaWeb初学者session的使用
使用request对象的getSession()获取session,如果session不存在则创建一个 HttpSession session = request.getSession();将数据存储 ...
- windows下使用libsvm3.2
一.官方介绍 libsvm主页:https://www.csie.ntu.edu.tw/~cjlin/libsvm/index.html libsvm介绍文档:http://www.csie.ntu. ...
- jdk1.8Option类
目的:为了解决一个方法返回的参数可能为空而无法传入到新的方法做参数的问题,java8产生了新的内容:Option. 定义:Option是一个可以为空的容器对象(注意本质上是个万能对象). 常用方法:1 ...