solution.cpp 444 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <stdio.h>
int DP[1011][1011];
int main()
{
    int i, j;
    DP[1][0] = 1;
    for (i = 1; i <= 1010; i++)
        DP[i][0] = 1; //初始化
    for (i = 1; i <= 1010; i++)
    {
        for (j = 1; j <= i; j++)
        {
            if (i == j)
                DP[i][j] = DP[i][j - 1];
            else
                DP[i][j] = (DP[i - 1][j] + DP[i][j - 1]) % 2020;
        }
    }
    printf("%d", DP[1010][1010]);
    return 0;
}