问个问题和

 •  3个月前


include

using namespace std; int b;

void putapple(int n, int m, int p) {

if (n == 0 && m == 0) {
	b++;
	return;
}
if (n == 0 ) {
	return;
}
for (int a = 0; a <= p; a++) {
	putapple(n - 1, m - a, a);
}

}

int main() {

int t, n, m, p;
cin >> t;
for (int a = 1; a <= t; a++) {
	b = 0;
	cin >> m >> n;
	putapple(n, m, m);
	printf("%d\n", b);
}
return 0;

}


评论:

请先登录,才能进行评论