谁能帮我看看哪里思考错了?
查看原帖
谁能帮我看看哪里思考错了?
1269712
IoOozZzz楼主2024/3/5 17:04
#include <iostream>
using namespace std;

int solution(int N, int M, int wine)
{
	if (M == 0 && N == 0 && wine == 0)
	{
		return 1;
	}
	else if (N < 0 || M < 0)
	{
		return 0;
	}
	return solution(N - 1, M, wine * 2) + solution(N, M - 1, wine - 1);
}

int main()
{
	int N = 5, M = 10;
	cout << solution(N, M, 2) << endl;
	
}
2024/3/5 17:04
加载中...