# Series (GCC)

Source: Internet
Author: User
Document directory
• Series

IDE environment: Code: Blocks

Series time limit: 1000 ms memory limit: 10000 k total time limit: 3000 Ms

Description:

It is known that the K-order sequence is defined as f0 = 0, F1 = 0 ,..., Fk-2 = 0, fk-1 = 1; fn = fn-1 + fn-2 +... + FN-k, n = K, k + 1 ,..., Write a function algorithm to calculate the M-th value of the k-th order sequence of symmetric pona. Both K and M appear in the function parameter table in the form of value calls.

Input:

Enter two positive integers K m (1

Output:

Output the value of the M entry of the K-order sequence.

Input example:

(Note: All data involved in this question is within the range of long integer data)

Output example:

2 3

Tip:

2

Source:

Code:

`#include <stdio.h>#include <stdlib.h>long int charter(int k,int m){    long int PeiBo[m];    if(k<=m)    {        int i,j;        PeiBo[0]=0;        for(i=1;i<=m+1;i++)        {            PeiBo[i]=0;        }        PeiBo[k]=1;        for(j=k+1;j<=m+1;j++)        {            for(i=1;i<=k;i++)            {                PeiBo[j]=PeiBo[j]+PeiBo[j-i];            }        }        return PeiBo[m+1];    }    else    {        return 0;    }}int main(){    int k=0,m=0;    scanf("%d%d",&k,&m);    long int d;    d=charter(k,m);    printf("%ld\n",d);    return 0;}`

Related Keywords:

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.