Created
June 4, 2021 06:41
-
-
Save sakapon/2cd25ae9a43d61370c0c08c94847a7f0 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q050
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Q050 | |
{ | |
const long M = 1000000007; | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() | |
{ | |
var (n, l) = Read2(); | |
var dp = new long[n + l]; | |
dp[0] = 1; | |
for (int i = 0; i < n; i++) | |
{ | |
dp[i + 1] += dp[i]; | |
dp[i + 1] %= M; | |
dp[i + l] += dp[i]; | |
dp[i + l] %= M; | |
} | |
Console.WriteLine(dp[n]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23163783