当前位置:网站首页>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;
}
边栏推荐
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- Educational Codeforces Round 22 E. Army Creation
- 华为nova 10系列支持应用安全检测功能 筑牢手机安全防火墙
- Find the nth power of 2
- Pointnet / pointnet++ point cloud data set processing and training
- 1009 product of polynomials (25 points) (PAT class a)
- 1005 spell it right (20 points) (pat a)
- Jetpack compose tutorial
- Neural network IOT platform construction (IOT platform construction practical tutorial)
- HDU 1372 & POJ 2243 Knight moves (breadth first search)
猜你喜欢
Application practice | Shuhai supply chain construction of data center based on Apache Doris
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
C# 使用StopWatch测量程序运行时间
92. (cesium chapter) cesium building layering
BCG 使用之CBCGPProgressDlg进度条使用
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
YOLOv5s-ShuffleNetV2
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
实战模拟│JWT 登录认证
Employment prospects and current situation of Internet of things application technology
随机推荐
Multi table operation - external connection query
92. (cesium chapter) cesium building layering
Reflection (I)
Educational codeforces round 22 E. Army Creation
Dark horse programmer - software testing - 09 stage 2-linux and database -31-43 instructions issued by modifying the file permission letter, - find the link to modify the file, find the file command,
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
On communication bus arbitration mechanism and network flow control from the perspective of real-time application
1002. A+B for Polynomials (25)(PAT甲级)
应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
Cbcgpprogressdlg progress bar used by BCG
牛客小白月赛7 I 新建 Microsoft Office Word 文档
黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
多表操作-内连接查询
Stream stream
线上数据库迁移的几种方法
What are the consequences of closing the read / write channel?
HDU 1372 & POJ 2243 Knight moves (breadth first search)
1009 Product of Polynomials(25 分)(PAT甲级)
Functional interface
Double colon function operator and namespace explanation