Board logo

標題: 2/26 5x5的圖形請算出左上至右下不重複路線數量及路線 [打印本頁]

作者: justtim    時間: 2011-2-26 20:22     標題: 2/26 5x5的圖形請算出左上至右下不重複路線數量及路線

本帖最後由 justtim 於 2011-2-26 21:37 編輯

如果不是5x5 就將tra函數多加兩個參數x_end , y_end
  1. #include<iostream>
  2. #include<sstream>

  3. using namespace std ;
  4. int all = 0 ;
  5. void tra( int x , int y , string ta )
  6. {
  7.      if( x == 5 && y == 5 )
  8.      {
  9.          all ++ ;
  10.          cout << ta << "(" << x << "," << y << ")" << endl ;            
  11.      }
  12.      else
  13.      {
  14.          stringstream st ;
  15.          st << ta << "(" << x << "," << y << ")" ;
  16.          
  17.           if( x < 5 )
  18.           {
  19.               tra( x + 1 , y , st.str() ) ;
  20.           }
  21.           if( y < 5 )
  22.           {
  23.               tra( x , y + 1 , st.str() ) ;   
  24.           }
  25.      }
  26. }

  27. int main()
  28. {
  29.     tra( 0 , 0 , "" ) ;  
  30.     cout << all << endl ;
  31.     system( "Pause" ) ;
  32. }
複製代碼

作者: wind1379    時間: 2011-2-26 20:41

本帖最後由 wind1379 於 2011-2-26 21:22 編輯

#include<iostream>

using namespace std;

int main()
{
    int map2[6][6];
    for(int i=0;i<6;i++)
    {
        for(int j=0;j<6;j++)
        {
            map2[j]=0;
        }
    }
    map2[0][0]=1;
    for(int i=0;i<6;i++)
    {
        for(int j=0;j<6;j++)
        {
            if(i>0)
            {
                map2[j]+=map2[i-1][j];
            }
            if(j>0)
            {
                map2[j]+=map2[j-1];
            }
//            cout << map2[j] << "\t";
        }
//        cout << endl;
    }
    cout << map2[5][5];
   
    system("pause");
}
作者: a3218290    時間: 2011-2-26 20:54

#include <iostream>
#include <cstdlib>
#include<string>
using namespace std;
//int a[100][2] ;
int Go(int nowx,int nowy,int a[100][2],int deep)
{
   if(nowx==5 && nowy==5)
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      for(int i=0;i<=deep;i++)
      {
         cout << "(" << a[i][0] << "," << a[i][1] << ")->"    ;  
      }
      cout  << endl<< endl ;   
   }else if(nowx==5)
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      Go(5,nowy+1,a,deep+1) ;
   }else if(nowy==5)
   {
     a[deep][0]=nowx ;
     a[deep][1]=nowy;
      Go(nowx+1,5,a,deep+1) ;     
   }else
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      Go(nowx+1,nowy,a,deep+1) ;
      Go(nowx,nowy+1,a,deep+1) ;   
         
   }   
   
}
int main(void){
   
   int a[100][2] ;
   
   Go(0,0,a,0) ;
   system("pause");
   return 0;
}
列出來了  只有路線+ +
作者: a3218290    時間: 2011-2-26 21:12

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(5,0)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(4,1)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(4,1)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(4,1)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(4,1)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(4,0)->(4,1)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(4,1)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(4,1)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(4,1)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(3,0)->(3,1)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(4,1)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(4,1)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(2,0)->(2,1)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(4,1)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->
作者: a3218290    時間: 2011-2-26 21:14

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(1,0)->(1,1)->(1,2)->(1,3)->(1,4)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(4,1)->(5,1)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->


(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(4,1)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(3,1)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(1,4)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(1,1)->(1,2)->(1,3)->(1,4)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(4,2)->(5,2)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(4,2)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(3,2)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(2,2)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->
作者: a3218290    時間: 2011-2-26 21:15

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(1,4)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(1,4)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(1,2)->(1,3)->(1,4)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(4,3)->(5,3)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(4,3)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(3,3)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(2,3)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(1,4)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(1,4)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(1,4)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(1,3)->(1,4)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(1,4)->(2,4)->(3,4)->(4,4)->(5,4)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(1,4)->(2,4)->(3,4)->(4,4)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(1,4)->(2,4)->(3,4)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(1,4)->(2,4)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(1,4)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->

(0,0)->(0,1)->(0,2)->(0,3)->(0,4)->(0,5)->(1,5)->(2,5)->(3,5)->(4,5)->(5,5)->
作者: 蔡昀修    時間: 2011-2-26 21:26

完整版
#include <iostream>
#include <cstdlib>
#include<string>
using namespace std;
//int a[100][2] ;
int b = 0;
int Go(int nowx,int nowy,int a[100][2],int deep)
{
   if(nowx==5 && nowy==5)
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      for(int i=0;i<=deep;i++)
      {
         cout << "(" << a[i][0] << "," << a[i][1] << ")->"    ;  
      }
      cout << endl;
      b++ ;  
   }else if(nowx==5)
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      Go(5,nowy+1,a,deep+1) ;
   }else if(nowy==5)
   {
     a[deep][0]=nowx ;
     a[deep][1]=nowy;
      Go(nowx+1,5,a,deep+1) ;     
   }else
   {
      a[deep][0]=nowx ;
      a[deep][1]=nowy;
      Go(nowx+1,nowy,a,deep+1) ;
      Go(nowx,nowy+1,a,deep+1) ;   
         
   }   
   
}
int main()
{

   
   int a[100][2] ;
   
   Go(0,0,a,0) ;
   cout << b << "種" <<endl;
   system("pause");
   return 0;
}




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2