当前位置:网站首页>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;
}
边栏推荐
- node_ Exporter deployment
- 多表操作-外连接查询
- 双冒号作用运算符以及命名空间详解
- Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
- HDU 6440 2018 Chinese college student program design network competition
- 【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
- C# 使用StopWatch测量程序运行时间
- Several methods of online database migration
- 黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
- Crystal optoelectronics: ar-hud products of Chang'an dark blue sl03 are supplied by the company
猜你喜欢
C# 使用StopWatch测量程序运行时间
Key rendering paths for performance optimization
华为nova 10系列支持应用安全检测功能 筑牢手机安全防火墙
Process of manually encrypt the mass-producing firmware and programming ESP devices
C语言-入门-基础-语法-流程控制(七)
Application practice | Shuhai supply chain construction of data center based on Apache Doris
Neural network IOT platform construction (IOT platform construction practical tutorial)
Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
实战模拟│JWT 登录认证
Mysql database basic operation -ddl | dark horse programmer
随机推荐
黑马程序员-软件测试--08阶段2-linux和数据库-23-30-进程端口相关,修改文件权限,端口号信息的获取,程序和进程相关操作,linux命令案例
JVM系列之对象的创建
socket编程demo二
Niuke Xiaobai month race 7 who is the divine Archer
kotlin 循环控制
Personal thoughts on Architecture Design (this article will be revised and updated continuously later)
1009 product of polynomials (25 points) (PAT class a)
Jetpack Compose 教程
Development and construction of DFI ecological NFT mobile mining system
On communication bus arbitration mechanism and network flow control from the perspective of real-time application
Educational Codeforces Round 22 E. Army Creation
HDU 6440 2018中国大学生程序设计网络选拔赛
Free soldier
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
TCP waves twice, have you seen it? What about four handshakes?
Basic use of kotlin
Some thoughts on whether the judgment point is located in the contour
输入的查询SQL语句,是如何执行的?
[QNX Hypervisor 2.2用户手册]6.3.1 工厂页和控制页
In operation (i.e. included in) usage of SSRs filter