相传李白去打酒.
话说大 诗人李白去打酒,一生好饮。幸好他从不开车
一天诗人李白,他提着酒壶,从家里出发,酒壶中有酒2升,他边走边唱
无事街上走,提壶去打酒
逢店加一倍,遇花喝一斗
这一路上他共遇到店5次 ,花10次
一直最后一次遇到的是花,他正好把酒喝光了;
请你计算李白遇到店和花的次序,可以把遇店纪为a遇花记为b,想这样的答案一共有多少种*/
#include<stdio.h.>
#include<string.h>
int count=0;
char a[16];
void fun(int num,int flower,int jiu,int store )
{
if(jiu<0||flower>10||store>5)
{
return ;
}
else if(num==13&&store==5&&jiu==2)
{
count++;
PRintf("%Ls/n",a);
return ;
}
else if(num<13)
{
a[num]='B';
fun(num+1,flower+1,jiu-1,store);
a[num]='A';
fun(num+1,flower,jiu*2,store+1);
}
}
int main()
{
a[15]='/0';
a[14]='B';
a[13]='A';
///a[0]=' ';
fun(0,0,2,0);
//printf("/n");
printf("%d/n",count);
return 0;
}
新闻热点
疑难解答