【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 ...
随机推荐
- 【XSY2989】字符串
题目来源:NOI2018模拟测试赛(二十六) 题解: 首先由于这是个01串,所以反对称串的意思就是这个字符串的后半部分是前半部分的反转且翻转结果: 一个串出现有三种情况:在前半部分,在后半部分或穿过中 ...
- php字符处理
1.strstr 截取某个字符后的字符: echo strstr("123456789","5");//输出:6789
- vue 页面跳转及参数传递和接收
跳转: this.$router.push({name: 'My',params:{ id:'1',name:'anson'}}); 接收: {{this.$route.params.id}}
- 高级聚合函数rollup(),cube(),grouping sets()
rollup(),cube(),grouping sets() 上面这几个函数,是对group by分组功能做的功能扩展. a.rollup() 功能:在原结果基础上追加一行总合计记录 ...
- 2015 Multi-University Training Contest 8 hdu 5390 tree
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 5390 ...
- git batch
git batch 不用每次自己写了:不是特别推荐哦: git add . git commit -m "commit" git push git status
- 怎么用命令行运行jar文件
假设你配置好了jre环境,你如今有一个打包好的jar文件,你能够这样子開始运行 java -classpath example.jar mainClass -classpath告诉虚拟机在哪里找类的字 ...
- linux下使用DBCA(database configuration assistant)创建oracle数据库
前提:切换到图形界面 到Oracle的bin文件夹下,使用oracle用户.运行dbca就可以.和windows的效果一样. 假设出现乱码 export LANG="en_US:UTF-8& ...
- Apache shiro 笔记整理之编程式授权
下面内容是在看了涛哥的<跟我一起学shiro> 和 视频<一头扎入进shiro> 后整理出来备忘和方便自己和其它人学习. 个人主页:http://www.itit123.cn/ ...
- 【Oracle学习笔记】
内容主要包括: (1)三种循环及其简化 (2)游标的使用 (3)异常处理 (4)存储过程 (5)存储函数 (6)触发器 (7)其它pl/sql操作 ---------------loop循环定义变量- ...