Words of the great poet Li Bai, and his good drink. Fortunately, he never drove.
One day, he carried the jug, out of the house, in jug wine bucket 2. He Life on a String:
无事街上走,提壶去打酒。
逢店加一倍,遇花喝一斗。
Along the way, he met a total of five stores, flower encountered 10 times, the last known encounter was spent, he just drank up the wine.
Please work shop and met Li Bai order flowers, you can store recorded as the case of a, the event took denoted b. Then: babaabbabbabbbb is a reasonable order. The answer like this, a total of how much of it? Please work out the number of all possible options (including the title given).
#include<iostream>
using namespace std;
int ans;
void dfs(int dian,int hua,int jiu)
{
if(dian>5||hua>10||jiu<0) return ;
if(dian==5&&hua==9&&jiu==1)
{
ans++;
return ;
}
dfs(dian+1,hua,jiu*2);
dfs(dian,hua+1,jiu-1);
}
int main()
{
dfs(0,0,2);
cout<<ans<<endl;
}
This question can also be used to do the whole arrangement, but the whole arrangement must be in good order, or can not fully enumerate.