從我做起振
我做起振興
做起振興中
起振興中華
>
很顯然 這是 一個用dfs 深搜的 題目
很簡單
#include<iostream>
int count1 = 0;
void f(int x, int y){
if(x == 4 && y == 3 ){
count1 ++;
return;
}
if(x + 1 < 5 )
f(x + 1, y);// 橫向掃描
if(y + 1< 4)
f(x, y + 1);// 縱向掃描
}
int main(){
// 從我做起 振興中華
f(0, 0);
cout << count1 << endl;
}
答案爲: 35種