You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
400 B

#include <bits/stdc++.h>
using namespace std;
int func(int x, int y, int z) {
if (x == 1 || y == 1 || z == 1) return 1;
if (x < y && x < z)
return func(x, y - 1, z) + func(x, y, z - 1);
if (y < x && y < z)
return func(x - 1, y, z) + func(x, y, z - 1);
return func(x - 1, y, z) + func(x, y - 1, z);
}
int main() {
cout << func(3, 3, 2);
return 0;
}