10 solutions

  • 3
    @ 2023-9-21 15:27:26

    #include<stdio.h>

    int main() {

    int n,a[10000007];

    scanf("%d",&n);

    a[1]=1,a[2]=1;

    if(n= =1 || n= =2){printf("1");}

    else {

    for(int i=3;i<=n;i++)

    {

    a[i]=a[i-1]%10007+a[i-2]%10007;

    }

    printf("%d",a[n]%10007);

    }

    return 0;

    }

    Information

    ID
    38
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    2327
    Accepted
    309
    Uploaded By