Submission #19429897


Source Code Expand

Copy
n,k=map(int,input().split())
mod=10**9+7
dp=[[0]*2 for _ in range(n+1)]
dp[0][0]=1
dp[1][1]=1
accum=1
for i in range(2,n+1):
    dp[i][0]+=accum
    if i>=k:
        accum-=dp[i-k][0]
    dp[i][1]+=accum
    accum+=dp[i][0]
    dp[i][0]%=mod
    dp[i][1]%=mod
    accum%=mod
print(dp[-1][-1])

Submission Info

Submission Time
Task F - 準急
User n_wisteria
Language Python (3.8.2)
Score 4
Code Size 307 Byte
Status AC
Exec Time 1299 ms
Memory 159704 KB

Judge Result

Set Name All
Score / Max Score 4 / 4
Status
AC × 7
Set Name Test Cases
All 00, 01, 02, 03, 04, 90, 91
Case Name Status Exec Time Memory
00 AC 1299 ms 159440 KB
01 AC 1178 ms 159704 KB
02 AC 556 ms 77524 KB
03 AC 409 ms 57812 KB
04 AC 1151 ms 148152 KB
90 AC 26 ms 9184 KB
91 AC 26 ms 8908 KB