public class Main {
public static void main(String[] args) {
dfs(1, 9, 16);
System.out.println(sum);
}
static int sum = 0;
static void dfs(int x, int a, int b) {
if (x == 8) {
if (a == 0 && b == 0) {
//如果七个人恰好分完则计数加一
sum++;
}
return;
}
for (int i = 0; i <= a; i++) {
for (int j = 0; j <= b; j++) {
if (i + j >= 2 && i + j <= 5) {
//只有满足2-5的条件才可以
dfs(x + 1, a - i, b - j);
}
}
}
}
}