当前位置:网站首页>[ahoi2009]chess Chinese chess - combination number optimization shape pressure DP
[ahoi2009]chess Chinese chess - combination number optimization shape pressure DP
2022-07-06 10:58:00 【Wawa source】
Topic link
Excerpt from :
Dream_Maker_yangkai
link
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
const int N = 110,mod = 9999973;
int f[N][N][N];
int C[N][N];
int n,m;
signed main()
{
cin>>n>>m;
for(int i=0;i<N;i++){
for(int j=0;j<=i;j++){
if(!j)C[i][j]=1;
else C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
}
}
if(n<m)swap(n,m);
f[0][0][0]=1;
//f[i][j][k] To i That's ok , Yes j Listed 1 Number ,k Listed 2 The number of schemes .
for(int i=1;i<=n;i++)
{
for(int j=0;j<=m;j++)
{
for(int k=0;k<=m-j;k++)
{
int &v=f[i][j][k];
// Choose nothing
v=f[i-1][j][k];
// The first i OK, let's go 1 individual Put the quantity as 0 On the list of
if(j)v=(v+f[i-1][j-1][k]*C[m-j-k+1][1]%mod)%mod;
// The first i OK, let's go 1 individual Put the quantity as 1 On the list of
if(k>=1&&j<=m-1)v=(v+f[i-1][j+1][k-1]*C[j+1][1]%mod)%mod;
// The first i OK, let's go 2 individual Put them into two quantities respectively 0 On the list of
if(j>=2)v=(v+f[i-1][j-2][k]*C[m-j-k+2][2]%mod)%mod;
// The first i OK, let's go 2 individual Put them in a quantity of 0 and 1 On the list of
if(j&&k)v=(v+f[i-1][j][k-1]*j%mod*(m-j-k+1)%mod)%mod;
// The first i OK, let's go 2 individual Put them into two quantities respectively 1 On the list of
if(k>=2&&j<=m-2)v=(v+f[i-1][j+2][k-2]*C[j+2][2]%mod)%mod;
}
}
}
int res=0;
for(int i=0;i<=m;i++)
for(int j=0;j<=m-i;j++)
res=(res+f[n][i][j])%mod;
cout<<res<<endl;
}
边栏推荐
- Copy constructor template and copy assignment operator template
- 解决扫描不到xml、yml、properties文件配置
- API learning of OpenGL (2001) gltexgen
- MySQL22-逻辑架构
- Pytoch LSTM implementation process (visual version)
- npm一个错误 npm ERR code ENOENT npm ERR syscall open
- Ubuntu 20.04 安装 MySQL
- MySQL completely uninstalled (windows, MAC, Linux)
- MySQL31-MySQL事务日志
- Mysql30 transaction Basics
猜你喜欢
csdn-Markdown编辑器
CSDN问答标签技能树(一) —— 基本框架的构建
MySQL25-索引的创建与设计原则
CSDN question and answer module Title Recommendation task (I) -- Construction of basic framework
Mysql25 index creation and design principles
MySQL27-索引優化與查詢優化
Navicat 导出表生成PDM文件
[reading notes] rewards efficient and privacy preserving federated deep learning
Mysql35 master slave replication
[recommended by bloggers] C # generate a good-looking QR code (with source code)
随机推荐
CSDN question and answer tag skill tree (I) -- Construction of basic framework
CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
Global and Chinese markets for aprotic solvents 2022-2028: Research Report on technology, participants, trends, market size and share
Kubesphere - deploy the actual combat with the deployment file (3)
Mysql36 database backup and recovery
[BMZCTF-pwn] 12-csaw-ctf-2016-quals hungman
API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T
Some problems in the development of unity3d upgraded 2020 VR
Postman environment variable settings
Other new features of mysql18-mysql8
CSDN问答标签技能树(五) —— 云原生技能树
MySQL36-数据库备份与恢复
[recommended by bloggers] C MVC list realizes the function of adding, deleting, modifying, checking, importing and exporting curves (with source code)
API learning of OpenGL (2002) smooth flat of glsl
Nanny hand-in-hand teaches you to write Gobang in C language
February 13, 2022-2-climbing stairs
Mysql28 database design specification
MySQL24-索引的数据结构
Isn't there anyone who doesn't know how to write mine sweeping games in C language
CSDN markdown editor