标签:else include cst space cout lib namespace sea iostream
//AC自动机x
#include<iostream>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int a[10][10],t=0;
int h[4]= {1,2,2,1};//横坐标
int z[4]= {2,1,-1,-2};//纵坐标
int search(int);
int print(int);
int main() {
a[1][1]=0;
a[1][2]=0;
search(2);
return 0;
}
int search(int i)
{
for(int j=0;j<4;j++)
{
if(a[i-1][2]+h[j]>=0&&a[i-1][2]+h[j]<=8&&a[i-1][1]+z[j]>=0&&a[i-1][1]<=4)
{
a[i][1]=a[i-1][1]+z[j];
a[i][2]=a[i-1][2]+h[j];
if(a[i][1]==4&&a[i][2]==8) print(i);
else search(i+1);
}
}
}
int print(int ii) {
t++;
cout<<t<<": ";
for (int i=1; i<=ii-1; i++)
cout<<a[i][1]<<","<<a[i][2]<<"-->";
cout<<"4,8"<<endl;
}
标签:else include cst space cout lib namespace sea iostream
原文地址:http://www.cnblogs.com/zxqxwnngztxx/p/6607560.html