当前位置:网站首页>repeat_ P1002 [NOIP2002 popularization group] cross the river pawn_ dp
repeat_ P1002 [NOIP2002 popularization group] cross the river pawn_ dp
2022-07-04 20:06:00 【This question AC sleep again】
repeat_P1002 [NOIP2002 Popularization group ] River crossing pawn _dp
//
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int dx[]={ 0,1,1,-1,-1,2,2,-2,-2 };
const int dy[]={ 0,2,-2,2,-2,1,-1,1,-1 };
const int N=22;
bool used[N][N];
LL dp[N][N];
int n,m,x,y;
void init()
{
memset( used,0,sizeof( used ) );
memset( dp,0,sizeof( dp ) );
int i,j,tx,ty;
for( i=0;i<9;i++ )
{
tx=x+dx[i]; ty=y+dy[i];
if( tx>=0 && tx<=n && ty>=0 && ty<=m ) used[tx][ty]=1;
}
for( i=0;i<=n;i++ ) // =
{
if( used[i][0] ) break; //
dp[i][0]=1;
}
for( j=0;j<=m;j++ ) // =
{
if( used[0][j] ) break; //
dp[0][j]=1;
}
}
int main()
{
int i,j;
while( cin>>n>>m>>x>>y )
{
init();
for( i=1;i<=n;i++ )
for( j=1;j<=m;j++ )
if( used[i][j]==0 )
dp[i][j]=dp[i-1][j]+dp[i][j-1];
cout<<dp[n][m]<<endl;
}
return 0;
}边栏推荐
- 有关架构设计的个人思考(本文后续不断修改更新)
- 明明的随机数
- BCG 使用之CBCGPProgressDlgCtrl进度条使用
- Free soldier
- Stream stream
- C language - Introduction - Foundation - grammar - process control (VII)
- 上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?
- What are the consequences of closing the read / write channel?
- Multi table operation - external connection query
- Decryption function calculates "task state and lifecycle management" of asynchronous task capability
猜你喜欢

多表操作-内连接查询

What does the neural network Internet of things mean? Popular explanation

Actual combat simulation │ JWT login authentication

Neural network IOT platform construction (IOT platform construction practical tutorial)

English grammar_ Noun - use

YOLOv5s-ShuffleNetV2

Cbcgpprogressdlg progress bar used by BCG

In operation (i.e. included in) usage of SSRs filter

黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,

ACM组合计数入门
随机推荐
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
1007 maximum subsequence sum (25 points) (PAT class a)
kotlin 循环控制
2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
Kotlin cycle control
输入的查询SQL语句,是如何执行的?
HMM hidden Markov model and code implementation
黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
1005 spell it right (20 points) (pat a)
92.(cesium篇)cesium楼栋分层
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
Niuke Xiaobai month race 7 F question
应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
双冒号作用运算符以及命名空间详解
1005 Spell It Right(20 分)(PAT甲级)
多表操作-外连接查询
Thinking on demand development
Jetpack compose tutorial
1002. A+B for Polynomials (25)(PAT甲级)
上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?