有趣的数组

2014-11-23 23:33:59 · 作者: · 浏览: 4

问题重现
根据蓝桥杯题目的简化,从”从“开始走,构成:从我做起振兴中华
从我做起振
我做起振兴
做起振兴中
起振兴中华

已知数组,如下:

int arr[SIZE][SIZE]={ 
    {0,1,2,3,4}, 
    {1,2,3,4,5}, 
    {2,3,4,5,6}, 
    {3,4,5,6,7} 
}; 

int arr[SIZE][SIZE]={
 {0,1,2,3,4},
 {1,2,3,4,5},
 {2,3,4,5,6},
 {3,4,5,6,7}
};

请试图去寻找一条轨迹(横走或者竖走,不允许按对角线走),轨迹为:01234567,求一共有多少种走法?

 //解法一:递归实现  
#include  
#define SIZE 5  
 
int count=0; 
 
void fun(int i,int j,int deep){ 
    if(deep==8){ 
        count++; 
        return; 
    } 
    if(i
#define SIZE 5

int count=0;

void fun(int i,int j,int deep){
 if(deep==8){
  count++;
  return;
 }
 if(i