8787: The Division of Numbers (and another apple)

Source: Internet
Author: User

8787: The division of Numbers

    • View
    • Submit
    • Statistics
    • Questions

Total time limit:

1000ms

Memory Limit:

65536kB

Describe

The integer n is divided into k parts, and each copy cannot be empty, and any two parts cannot be the same (regardless of order).

For example: N=7,k=3, the following three kinds of sub-methods are considered to be the same.

1,1,5; 1,5,1; 5,1,1;

Ask how many different sub-methods there are. Output: An integer, which is a different method of division.

Input

Two integers n,k (6 < n <= 200,2 <= k <= 6), separated by a single space in the middle.

Output

An integer, that is, a different method of division.

Sample input

3 ·

Sample output

4

Tips

The four kinds of methods are: 1,1,5;1,2,4;1,3,3;2,2,3.

Similar to putting apples: http://www.cnblogs.com/shenben/p/5564870.html

#include <cstdio>#include<cmath>#include<iostream>using namespacestd;Const intmaxn=1101;intF[MAXN][MAXN];intn,k;intMain () {scanf ("%d%d",&n,&k);  for(intI=1; i<=n;i++) f[i][1]=1, f[i][i]=1;  for(intI=2; i<=n;i++)       for(intj=1; j<i;j++) F[i][j]=f[i-j][j]+f[i-1][j-1]; printf ("%d", F[n][k]); return 0;}

8787: The Division of Numbers (and another apple)

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.