当前位置:网站首页>[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;
}
边栏推荐
- csdn-Markdown编辑器
- Idea import / export settings file
- [reading notes] rewards efficient and privacy preserving federated deep learning
- C语言标准的发展
- Just remember Balabala
- 保姆级手把手教你用C语言写三子棋
- MySQL19-Linux下MySQL的安装与使用
- NPM an error NPM err code enoent NPM err syscall open
- MNIST implementation using pytoch in jupyter notebook
- A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
猜你喜欢
[recommended by bloggers] background management system of SSM framework (with source code)
解决:log4j:WARN Please initialize the log4j system properly.
MySQL transaction log
IDEA 导入导出 settings 设置文件
MySQL32-锁
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
1. Mx6u learning notes (VII): bare metal development (4) -- master frequency and clock configuration
Win10: how to modify the priority of dual network cards?
CSDN问答标签技能树(五) —— 云原生技能树
Mysql21 user and permission management
随机推荐
MySQL23-存储引擎
CSDN markdown editor
Texttext data enhancement method data argument
Mysql22 logical architecture
C language advanced pointer Full Version (array pointer, pointer array discrimination, function pointer)
Moteur de stockage mysql23
API learning of OpenGL (2005) gl_ MAX_ TEXTURE_ UNITS GL_ MAX_ TEXTURE_ IMAGE_ UNITS_ ARB
Pytorch RNN actual combat case_ MNIST handwriting font recognition
Win10: how to modify the priority of dual network cards?
Navicat 导出表生成PDM文件
CSDN问答标签技能树(二) —— 效果优化
Csdn-nlp: difficulty level classification of blog posts based on skill tree and weak supervised learning (I)
MySQL flush operation
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
Global and Chinese markets of static transfer switches (STS) 2022-2028: Research Report on technology, participants, trends, market size and share
[C language foundation] 04 judgment and circulation
@Controller, @service, @repository, @component differences
[untitled]
[leectode 2022.2.13] maximum number of "balloons"
Solve the problem that XML, YML and properties file configurations cannot be scanned