package 历届试题;
public class 李白打酒 {
static int ans=0;
static void fun(int jiu,int house,int flower)
{
if(house==0)
{
if(flower==1&&jiu==1)
{
ans++;
System.out.println(ans);
return;
}
}
if(house>0)
fun(jiu*2,house-1,flower);
if(flower>0)
fun(jiu-1,house,flower-1);
}
public static void main(String[] args) {
fun(2,5,10);
}
}
李白打酒
最新推荐文章于 2023-04-07 12:12:57 发布