666: Put the Apples

Source: Internet
Author: User

The description puts the M-same apple on n identical plates, allowing some plates to be left 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. The first line of input is the number of test data t (0 <= T <= 20). Each of the following lines contains two integers m and n, separated by a space. 1<=m,n<=10. Output to each set of data input m and n, with a row to output the corresponding K. Sample input

17 3

Sample output

8

source [email protected]

1#include <cstdio>2 using namespacestd;3 intFintMintN)4 {5     if(n==1|| m==0)return 1; 6     if(n>m)returnf (m,m);7     returnF (m,n-1) +f (M-n,n);8 }9 Ten intMain () One { A     intnum; -scanf"%d",&num); -      while(num--) the     { -         intM,n; -scanf"%d%d",&m,&n); -printf"%d\n", F (m,n)); +     } -  +     return 0; A}

666: Put the Apples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.