solution.cpp 297 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <stdio.h>

int main()
{
    int n, b;
    scanf("%d", &n);
    int a[n];
    a[0] = a[1] = 1;

    for (int i = 2; i < n; i++)
    {
        a[i] = (a[i - 1] + a[i - 2]) % 10007;
        b = a[i];
    }
    if (n > 2)
        printf("%d", b);
    else
        printf("1");
    return 0;
}