当前位置:网站首页>repeat_P1002 [NOIP2002 普及组] 过河卒_dp
repeat_P1002 [NOIP2002 普及组] 过河卒_dp
2022-07-04 17:14:00 【这题AC再睡.】
repeat_P1002 [NOIP2002 普及组] 过河卒_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;
}边栏推荐
- Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
- Scala基础教程--16--泛型
- Unity makes revolving door, sliding door, cabinet door drawer, click the effect of automatic door opening and closing, and automatically play the sound effect (with editor extension code)
- 力扣刷题日记/day7/6.30
- 【2022年江西省研究生数学建模】水汽过饱和的核化除霾 思路分析及代码实现
- Deleting nodes in binary search tree
- Torchdrug tutorial
- Interpretation of SIGMOD '22 hiengine paper
- Detailed explanation of the maturity classification of ITSS operation and maintenance capability | one article clarifies the ITSS certificate
- Load test practice of pingcode performance test
猜你喜欢

How to modify icons in VBS or VBE

Scala basic tutorial -- 18 -- set (2)

力扣刷题日记/day6/6.28

Li Kou brush question diary /day6/6.28

Scala基础教程--13--函数进阶
![[HCIA continuous update] network management and operation and maintenance](/img/a4/406b145793b701b001f04c7538dab3.png)
[HCIA continuous update] network management and operation and maintenance

How is the entered query SQL statement executed?

基于NCF的多模块协同实例

力扣刷题日记/day2/2022.6.24

Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
随机推荐
Deleting nodes in binary search tree
C语言打印练习
Redis master-slave replication
如何使用 wget 和 curl 下载文件
TorchDrug教程
I always thought that excel and PPT could only be used for making statements until I saw this set of templates (attached)
大厂面试总结大全二
谷粒商城(一)
Nature Microbiology | 可感染阿斯加德古菌的六种深海沉积物中的病毒基因组
【210】PHP 定界符的用法
Is it safe to download the mobile version of Anxin securities and open an account online
2022年字节跳动日常实习面经(抖音)
基于unity的愤怒的小鸟设计
Scala basic tutorial -- 15 -- recursion
机器学习概念漂移检测方法(Aporia)
完善的js事件委托
力扣刷題日記/day6/6.28
提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
Esp32-c3 introductory tutorial questions ⑫ - undefined reference to ROM_ temp_ to_ power, in function phy_ get_ romfunc_ addr
力扣刷题日记/day2/2022.6.24