当前位置:网站首页>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;
}边栏推荐
- Key rendering paths for performance optimization
- [QNX hypervisor 2.2 user manual]6.3.1 factory page and control page
- 牛客小白月赛7 谁是神箭手
- Educational Codeforces Round 22 E. Army Creation
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- How is the entered query SQL statement executed?
- Free soldier
- Cbcgpprogressdlgctrl progress bar used by BCG
- 水晶光电:长安深蓝SL03的AR-HUD产品由公司供应
- Stream stream
猜你喜欢

多表操作-内连接查询

做社交媒体营销应该注意些什么?Shopline卖家的成功秘笈在这里!

C # use stopwatch to measure the running time of the program

黑马程序员-软件测试--08阶段2-linux和数据库-23-30-进程端口相关,修改文件权限,端口号信息的获取,程序和进程相关操作,linux命令案例

CANN算子:利用迭代器高效实现Tensor数据切割分块处理

What are the consequences of closing the read / write channel?

HMM隐马尔可夫模型最详细讲解与代码实现

Development and construction of DFI ecological NFT mobile mining system

Mysql database basic operation -ddl | dark horse programmer

Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
随机推荐
Jetpack compose tutorial
Utilisation de la barre de progression cbcggprogressdlgctrl utilisée par BCG
记一次 .NET 某工控数据采集平台 线程数 爆高分析
求2的n次方
abc229 总结(区间最长连续字符 图的联通分量计数)
Kotlin condition control
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
kotlin 条件控制
牛客小白月赛7 E Applese的超能力
On communication bus arbitration mechanism and network flow control from the perspective of real-time application
In the first month of its launch, the tourist praise rate of this campsite was as high as 99.9%! How did he do it?
Educational Codeforces Round 22 E. Army Creation
@transactional滥用导致数据源连接池耗尽问题
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
Several methods of online database migration
Find the nth power of 2
Data set division
Key rendering paths for performance optimization
Mysql database basic operation -ddl | dark horse programmer
How is the entered query SQL statement executed?