Problem: "Recursion" put the apple Title DescriptionChuji just took the oil to the kitchen, and mother shouted, "Go and wash the apples and put them on the plate." ”
Chuji to put m the same apples on n the same plate, allowing some plates to be empty, asking how many different ways are there? (denoted by K) 5, 1, 1 and 1, 5, 1 are the same kind of sub-method. InputThe 1th behavior is an integer that represents the number of test data (number of test data T (0≤t≤20), 2nd behavior m and N (M and N, separated by spaces. 1≤M,N≤10). Outputhow many different methods of output are there? Sample input
17 3
Sample output
8
#include <iostream>#include<cstdio>#include<cstring>using namespacestd;Const intN =2;intSlove (intMintN) { if(M = =0|| n = =1)return 1; if(M < n)returnSlove (m,m); returnSlove (M-n, N) +slove (m,n-1); }intMain () {intT,m,n; scanf ("%d", &t); while(t--) {scanf ("%d%d", &m, &N); printf ("%d\n", Slove (m,n)); } return 0;}
View Code
"Recursion" put the apple