//啤酒2元1瓶,4个瓶盖可换1瓶,2个空瓶也可换1瓶。请问10元能喝到几瓶啤酒
-(void)beerWithMoney:(NSInteger)money Cap:(NSInteger)cap bottle:(NSInteger)bottle Count:(NSInteger)count{
if(money<2&&cap<4&&bottle<2){
NSLog(@"%ld",count);
}
if (money>=2) {
[self beerWithMoney:money-2 Cap:cap+1 bottle:bottle+1 Count:count+1];
}
if (cap>=4) {
[self beerWithMoney:money Cap:cap-4+1 bottle:bottle+1 Count:count+1];
}
if (bottle>=2) {
[self beerWithMoney:money Cap:cap+1 bottle:bottle-2+1 Count:count+1];
}
}