Codeforces 128 C. Games with Rectangle
来源:互联网 发布:淘宝破损补寄什么意思 编辑:程序博客网 时间:2024/06/07 04:49
长宽是各自独立的,算出各自可以取的方法数后相乘....
In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines). The new rectangle should have no common points with the previous one. Note that when we paint a rectangle, we always paint only the border, the rectangles aren't filled.
Nobody wins the game — Anna and Maria simply play until they have done k moves in total. Count the number of different ways to play this game.
The first and only line contains three integers: n, m, k (1 ≤ n, m, k ≤ 1000).
Print the single number — the number of the ways to play the game. As this number can be very big, print the value modulo 1000000007(109 + 7).
3 3 1
1
4 4 1
9
6 7 2
75
Two ways to play the game are considered different if the final pictures are different. In other words, if one way contains a rectangle that is not contained in the other way.
In the first sample Anna, who performs her first and only move, has only one possible action plan — insert a 1 × 1 square inside the given3 × 3 square.
In the second sample Anna has as much as 9 variants: 4 ways to paint a 1 × 1 square, 2 ways to insert a 1 × 2 rectangle vertically, 2 more ways to insert it horizontally and one more way is to insert a 2 × 2 square.
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;typedef long long int LL;const LL MOD=1000000007LL;LL n,m,k;LL C[1200][1200];void init(){ for(int i=0;i<1200;i++) C[i][i]=C[i][0]=1LL; for(int i=2;i<1200;i++) { for(int j=1;j<i;j++) { C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD; } }}int main(){ init(); cin>>n>>m>>k; if(n-1<2*k||m-1<2*k) cout<<0<<endl; else cout<<(C[n-1][2*k]*C[m-1][2*k])%MOD<<endl; return 0;}
- Codeforces 128 C. Games with Rectangle
- CodeForces 128C Games with Rectangle 组合数学
- codeforces 129E/128C Games with Rectangle
- CodeForces 128C Games with Rectangle [组合数学+基础DP]
- C. Games with Rectangle CF 128C
- codeforce 128C Games with Rectangle 排列组合
- Codeforces Games
- CodeForces 281c Rectangle Puzzle 计算几何
- CodeForces 268A Games
- Make Games With Us Tutorials
- codeforces 401E. Olympic Games
- Codeforces #164 A. Games (水
- CodeForces-MemSQL start[c]up Round 1-B. Stadium and Games
- codeforces 245C Game with Coins
- CodeForces 482C Game with Strings
- codeforces 245C Game with Coins
- CodeForces 245C Game with Coins
- Codeforces 482C Game with strings
- awk
- 神马赤霞珠干红葡萄酒 上海樽杰进口葡萄酒
- Leetcode: Sort Colors
- Oracle Goldengate手工切换trail文件
- 心得之----XCode修改SVN地址方法
- Codeforces 128 C. Games with Rectangle
- iOS开发工程师
- 如何优化Cocos2d-X游戏的内存
- 加州理工学院公开课:雷蒙保罗MAPA泛化理论(第六课)
- __FILE__,__LINE__,__DATE__,__TIME__,__STDC__ 宏定义
- WebViewClient与WebChromeClient 区别
- It's the Star or Over?
- 多重继承和虚继承的内存布局
- android中layout的背景