結果
| 問題 |
No.612 Move on grid
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2020-06-04 18:18:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,192 ms / 2,500 ms |
| コード長 | 424 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 82,580 KB |
| 実行使用メモリ | 144,176 KB |
| 最終ジャッジ日時 | 2024-11-29 17:51:54 |
| 合計ジャッジ時間 | 10,855 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
from collections import defaultdict
t=int(input())
a,b,c,d,e=map(int,input().split())
md=10**9+7
dp=defaultdict(int)
dp[0]=1
for i in range(t):
ndp=defaultdict(int)
for s,k in dp.items():
ndp[s+a]+=k
ndp[s-a]+=k
ndp[s+b]+=k
ndp[s-b]+=k
ndp[s+c]+=k
ndp[s-c]+=k
for s in ndp.keys():ndp[s]%=md
dp=ndp
ans=0
for s in range(d,e+1):ans=(ans+dp[s])%md
print(ans)
mkawa2