結果

問題 No.1811 EQUIV Ten
ユーザー tktk_snsn
提出日時 2022-01-14 23:02:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,214 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-20 13:40:49
合計ジャッジ時間 11,748 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7
N = int(input())

dp = [0] * 8
dp[0] = 1
for _ in range(N):
    ndp = [0] * 8
    for i in range(8):
        ni = i + i
        if ni != 10:
            ndp[ni % 8] += dp[i]
        ndp[(ni + 1) % 8] += dp[i]
    for i in range(8):
        ndp[i] %= mod
    dp = ndp

print((pow(2, N, mod) - sum(dp)) % mod)
0