Skip to content

Instantly share code, notes, and snippets.

@sakapon
Created June 4, 2021 06:41
Show Gist options
  • Save sakapon/2cd25ae9a43d61370c0c08c94847a7f0 to your computer and use it in GitHub Desktop.
Save sakapon/2cd25ae9a43d61370c0c08c94847a7f0 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q050
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]);
}
}
@sakapon
Copy link
Author

sakapon commented Jun 4, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment