結果
| 問題 | No.612 Move on grid |
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2017-12-01 18:46:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 273 ms / 2,500 ms |
| コード長 | 624 bytes |
| 記録 | |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 82,588 KB |
| 実行使用メモリ | 143,344 KB |
| 最終ジャッジ日時 | 2025-12-05 13:12:33 |
| 合計ジャッジ時間 | 4,571 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
ソースコード
t = int(input())
a, b, c, d, e = map(int, input().split())
M = 1000000007
m = 20020
s = 10010
dp = [0 for i in range(m)]
dp[s] = 1
for i in range(t):
nex = [0 for i in range(m)]
for j in range(m):
if dp[j] > 0:
nex[j + a] = (nex[j + a] + dp[j]) % M
nex[j - a] = (nex[j - a] + dp[j]) % M
nex[j + b] = (nex[j + b] + dp[j]) % M
nex[j - b] = (nex[j - b] + dp[j]) % M
nex[j + c] = (nex[j + c] + dp[j]) % M
nex[j - c] = (nex[j - c] + dp[j]) % M
dp = nex
ans = 0
for i in range(s + d, s + e + 1):
ans = (ans + dp[i]) % M
print(ans)
りあん