标签:++ i++ main 水题 include blank ref http lin
水题
dfs裸基础
#include<cstdio> using namespace std; int n,m,mx[5]={0,1,1,2,2}, ans,my[5]={0,-2,2,-1,1}; inline void dfs(int x,int y){ if(x==m&&y==n){ ans++; return;} for(int i=1;i<=4;i++){ int tx=mx[i]+x,ty=my[i]+y; if(tx>0&&ty>0&&tx<=m&&ty<=n) dfs(tx,ty); } } int main() { freopen("horse.in","r",stdin); freopen("horse.out","w",stdout); scanf("%d%d",&n,&m); dfs(1,1); printf("%d",ans); return 0; }
标签:++ i++ main 水题 include blank ref http lin
原文地址:https://www.cnblogs.com/song-/p/9625408.html