| 记录编号 | 588678 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 49.跳马问题 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.010 s | ||
| 提交时间 | 2024-06-15 19:03:32 | 内存使用 | 0.57 MiB | ||
#include<bits/stdc++.h>
using namespace std;
int M,N;
int f(int m,int n);
int main()
{
freopen("horse.in","r",stdin);
freopen("horse.out","w",stdout);
cin>>M>>N;
cout<<f(M,N)<<endl;
return 0;
}
int f(int m,int n)
{
if(m<=0 or m>M or n<=0 or n>N) return 0;
if(m==1&&n==1) return 1;
int ans=f(m-2,n-1)+f(m-1,n-2)+f(m+1,n-2)+f(m+2,n-1);
return ans;
}