当前位置:网站首页>[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;
}
边栏推荐
- MySQL 29 other database tuning strategies
- 保姆级手把手教你用C语言写三子棋
- Redis的基础使用
- [C language foundation] 04 judgment and circulation
- Ansible实战系列二 _ Playbook入门
- Postman uses scripts to modify the values of environment variables
- A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
- MySQL36-数据库备份与恢复
- MySQL21-用户与权限管理
- MySQL27-索引优化与查询优化
猜你喜欢
[recommended by bloggers] asp Net WebService background data API JSON (with source code)
MySQL23-存儲引擎
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
Generate PDM file from Navicat export table
Mysql26 use of performance analysis tools
Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution
Idea import / export settings file
Breadth first search rotten orange
1. Mx6u learning notes (VII): bare metal development (4) -- master frequency and clock configuration
Mysql33 multi version concurrency control
随机推荐
Solve the problem that XML, YML and properties file configurations cannot be scanned
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T
Global and Chinese markets for aprotic solvents 2022-2028: Research Report on technology, participants, trends, market size and share
[leectode 2022.2.13] maximum number of "balloons"
The virtual machine Ping is connected to the host, and the host Ping is not connected to the virtual machine
[paper reading notes] - cryptographic analysis of short RSA secret exponents
Isn't there anyone who doesn't know how to write mine sweeping games in C language
解决扫描不到xml、yml、properties文件配置
C language string function summary
[untitled]
Win10: how to modify the priority of dual network cards?
Mysql23 storage engine
frp内网穿透那些事
导入 SQL 时出现 Invalid default value for ‘create_time‘ 报错解决方法
Yum prompt another app is currently holding the yum lock; waiting for it to exit...
MySQL22-逻辑架构
MySQL24-索引的数据结构
Mysql32 lock
Ansible实战系列三 _ task常用命令