Here's my answer, I am not sure if it's correct (It's written in Objective-C):

-(int)volleyball:(int) A joinArg2:(int) B {
if (A < 25 && B < 25)
return 0;
if (A >= B)
return [self volleyball:B joinArg2:A];
if (A >= 25) {
return 1 + [self volleyball:A joinArg2:A];
} else {
return [self dfs:A joinArg2:B-1];
}
}
-(int)dfs:(int)a joinArg2:(int)b {
if (a == 0 || b == 0) {
return 1;
}
return [self dfs:a-1 joinArg2:b] + [self dfs:a joinArg2:b-1];
}