**输出格式**
只有一个数:总方案数total。
by Koakuma @ 2019-10-04 13:44:03
%%%
by xiezihan @ 2019-10-04 13:52:01
oooooooooooooooooooooooooooooooooo
我还以为是要打印一个图呢
```cpp
."". ."",
| | / /
| | / /
| | / /
| |/ ;-._
} ` _/ / ;
| /` ) / /
| / /_/\_/\
|/ / |
( ' \ '- |
\ `. /
| |
| |
by D447H @ 2019-10-04 13:58:02
改了还是错的
```cpp
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int u[8]={1,2,2,1,-1,-2,-2,-1}; //8个方向上的x,y增量
int v[8]={-2,-1,1,2,2,1,-1,-2};
int a[100][100]={0},num=0; //记每一步走在棋盘的哪一格和棋盘的每一格有没有被走过
bool b[100][100]={0};
int search(int,int,int); //以每一格为阶段,在每一阶段中试遍8个方向
int print();
int main()
{
a[1][1]=1;b[1][1]=1; //从(1,1)第一步开始走
search(1,1,2); //从(1,1)开始搜第2步该怎样走
cout<<num<<endl; //输出总方案(304)
}
int search(int i,int j,int n)
{
int k,x,y; //这三个变量一定要定义局部变量
if (n>25) return 0; //达到最大规模打印、统计方案
for (k=0;k<=7;k++) //试遍8个方向
{
x=i+u[k];y=j+v[k]; //走此方向,得到的新坐标
if (x<=5&&x>=1&&y<=5&&y>=1&&(!b[x][y]))
{ //如果新坐标在棋盘上,并且这一格可以走
b[x][y]=1;
a[x][y]=n;
search(x,y,n+1); //从(x,y)去搜下一步该如何走
b[x][y]=0;
a[x][y]=0;
}
}
}
by D447H @ 2019-10-04 13:59:30
@[78_Minecraft_87](/space/show?uid=229450) 规定只能往右跳,不准往左跳
by cstdios @ 2019-10-04 14:01:13
只不过成TLE了
by D447H @ 2019-10-04 14:02:31
%%%
by 小main包 @ 2019-10-04 14:03:41
噢噢噢噢哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦
by D447H @ 2019-10-04 14:03:45
@[78_Minecraft_87](/space/show?uid=229450) 明白了吗?
by cstdios @ 2019-10-04 14:04:52
嗯
by D447H @ 2019-10-04 14:06:06