【题目链接】: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的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 630E】A rectangle

    [题目链接]:http://codeforces.com/problemset/problem/630/E [题意] 给你一个矩形的区域; 然后让你统计这个矩形区域内,有多少个正六边形. [题解] 规 ...

  3. 【45.65%】【codeforces 560B】Gerald is into Art

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  4. 【25.64%】【codeforces 570E】Pig and Palindromes

    time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. 【84.62%】【codeforces 552A】Vanya and Table

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  6. 【codeforces 754B】 Ilya and tic-tac-toe game

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. 【codeforces 758C】Unfair Poll

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  8. 【codeforces 546D】Soldier and Number Game

    time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. 【codeforces 752F】Santa Clauses and a Soccer Championship

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

随机推荐

  1. [NOIP补坑计划]NOIP2015 题解&做题心得

    感觉从15年开始noip就变难了?(虽然自己都做出来了……) 场上预计得分:100+100+60~100+100+100+100=560~600(省一分数线365) 题解: D1T1 神奇的幻方 题面 ...

  2. python_三级字典

    data = { "北京":{ "昌平":{ "沙河":["oldboy","test"], &qu ...

  3. 2019-03-28 SQL Server Table

    -- table 是实际表 view是虚表.你可以认为view是一个查询的结果 -- 声明@tbBonds table declare @tbBonds table(TrustBondId int n ...

  4. 小学生都能学会的python(运算符 和 while循环)

    ---恢复内容开始--- 小学生都能学会的python(运算符和编码) 一.格式化输出 #占位:"%s"占位,占得是字符串,"%d"占位,占的是数字. # 让用 ...

  5. Java并发和多线程2:3种方式实现数组求和

    本篇演示3个数组求和的例子. 例子1:单线程例子2:多线程,同步求和(如果没有计算完成,会阻塞)例子3:多线程,异步求和(先累加已经完成的计算结果) 例子1-代码 package cn.fansuni ...

  6. SpringBoot中打包设置,将配置文件打包在外部

    一.每次用maven的打包工具打包的时候 总是将配置文件一起打包进jar中!配置文件有点小修改就要重新打包很麻烦!!!!为了解决这一麻烦!找 了很多方法,下面的配置已经实现可用 我的项目目录结构如下 ...

  7. Maven学习总结(24)——Maven版本管理详解

    Maven的版本分为快照和稳定版本,快照版本使用在开发的过程中,方便于团队内部交流学习.而所说的稳定版本,理想状态下是项目到了某个比较稳定的状态,这个稳定包含了源代码和构建都要稳定. 一.如何衡量项目 ...

  8. ASP.NET-ActionResutlt

    @RenderPage("Page_part1"); 上面的这种写法是错误的应该是 @RenderPage("Page_part1.cshtml"); // 要 ...

  9. weblogic部署struts2项目訪问action404错误

    近期有个project部署到tomcat上是正常的,部署到weblogic上时訪问action报404错误.依据报错日志.在网上找到了原因例如以下: 部署到weblogic上.struts.xml配置 ...

  10. JavaScript-4.4函数递归之阶乘举例---ShinePans

    <html> <head> <meta http-equiv="content-type" content="text/html;chars ...