結果

問題 No.1811 EQUIV Ten
ユーザー ああいいああいい
提出日時 2022-01-14 22:25:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 366 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 170,452 KB
最終ジャッジ日時 2024-04-30 15:45:07
合計ジャッジ時間 5,174 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,820 KB
testcase_01 AC 32 ms
53,160 KB
testcase_02 AC 42 ms
61,472 KB
testcase_03 AC 31 ms
53,340 KB
testcase_04 AC 32 ms
53,016 KB
testcase_05 AC 31 ms
53,356 KB
testcase_06 AC 35 ms
52,648 KB
testcase_07 AC 37 ms
52,652 KB
testcase_08 AC 32 ms
53,052 KB
testcase_09 AC 32 ms
53,972 KB
testcase_10 AC 41 ms
53,880 KB
testcase_11 AC 301 ms
154,612 KB
testcase_12 AC 322 ms
160,508 KB
testcase_13 AC 354 ms
168,100 KB
testcase_14 AC 366 ms
170,452 KB
testcase_15 AC 365 ms
170,308 KB
testcase_16 AC 35 ms
53,408 KB
testcase_17 AC 51 ms
64,972 KB
testcase_18 AC 52 ms
66,756 KB
testcase_19 AC 41 ms
61,080 KB
testcase_20 AC 68 ms
80,636 KB
testcase_21 AC 67 ms
79,744 KB
testcase_22 AC 49 ms
65,520 KB
testcase_23 AC 170 ms
108,396 KB
testcase_24 AC 80 ms
82,652 KB
testcase_25 AC 52 ms
65,824 KB
testcase_26 AC 145 ms
101,896 KB
testcase_27 AC 56 ms
72,124 KB
testcase_28 AC 35 ms
53,396 KB
testcase_29 AC 41 ms
62,620 KB
testcase_30 AC 302 ms
152,028 KB
testcase_31 AC 58 ms
73,952 KB
testcase_32 AC 81 ms
82,132 KB
testcase_33 AC 79 ms
82,420 KB
testcase_34 AC 286 ms
148,120 KB
testcase_35 AC 145 ms
101,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
dp = [[[0] * 16 for _ in range(2)] for _ in range(N+1)]
dp[0][0][0] = 1
P = 10 ** 9 + 7
for i in range(N):
    for bit in range(16):
        b = (bit << 1) % 16
        c = (bit << 1) % 16 + 1
        dp[i+1][1][b] += dp[i][1][bit]
        dp[i+1][1][c] += dp[i][1][bit]
        if b == 10:
            dp[i+1][1][b] += dp[i][0][bit]
        else:
            dp[i+1][0][b] += dp[i][0][bit]
        if c == 10:
            dp[i+1][1][c] += dp[i][0][bit]
        else:
            dp[i+1][0][c] += dp[i][0][bit]
    for bit in range(8):
        for f in range(2):
            dp[i+1][f][bit] %= P
print(sum(dp[-1][1])%P)
0