P1002 过河卒

所谓年轻,就是意识不到自己的年轻

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
unsigned long long n,m;
unsigned long long x,y;
unsigned long long dp[30][30];
unsigned long long Miku[30][30];
signed main(){
	cin>>x>>y>>n>>m;
	x+=2;
	y+=2;
	n+=2;
	m+=2;
	Miku[n][m]=1;
	Miku[n-2][m+1]=1;
	Miku[n-2][m-1]=1;
	Miku[n+2][m+1]=1;
	Miku[n+2][m-1]=1;
	Miku[n+1][m+2]=1;
	Miku[n+1][m-2]=1;
	Miku[n-1][m-2]=1;
	Miku[n-1][m+2]=1;
	dp[2][2]=1;
	for(unsigned long long i=2;i<=x;++i){
		for(unsigned long long j=2;j<=y;++j){
			if(Miku[i][j])
			continue;
			dp[i][j]=max(dp[i][j],dp[i-1][j]+dp[i][j-1]);
		}
	}
	cout<<dp[x][y];
	return 0;
}
上一篇:闭包的应用场景


下一篇:flutter 切换环境