結果

問題 No.1811 EQUIV Ten
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-01-14 22:01:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2024-04-30 14:43:45
合計ジャッジ時間 2,474 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,320 KB
testcase_01 AC 36 ms
52,316 KB
testcase_02 AC 38 ms
54,040 KB
testcase_03 AC 34 ms
53,540 KB
testcase_04 AC 33 ms
53,016 KB
testcase_05 AC 33 ms
52,896 KB
testcase_06 AC 34 ms
52,752 KB
testcase_07 AC 34 ms
52,316 KB
testcase_08 AC 33 ms
52,872 KB
testcase_09 AC 33 ms
52,864 KB
testcase_10 AC 33 ms
52,080 KB
testcase_11 AC 52 ms
75,884 KB
testcase_12 AC 54 ms
75,896 KB
testcase_13 AC 56 ms
75,704 KB
testcase_14 AC 55 ms
75,884 KB
testcase_15 AC 54 ms
75,724 KB
testcase_16 AC 34 ms
54,028 KB
testcase_17 AC 34 ms
53,744 KB
testcase_18 AC 39 ms
61,012 KB
testcase_19 AC 33 ms
52,516 KB
testcase_20 AC 40 ms
61,272 KB
testcase_21 AC 42 ms
61,604 KB
testcase_22 AC 41 ms
60,232 KB
testcase_23 AC 46 ms
69,032 KB
testcase_24 AC 40 ms
62,012 KB
testcase_25 AC 39 ms
59,668 KB
testcase_26 AC 44 ms
67,764 KB
testcase_27 AC 40 ms
60,960 KB
testcase_28 AC 33 ms
53,228 KB
testcase_29 AC 32 ms
52,328 KB
testcase_30 AC 52 ms
75,672 KB
testcase_31 AC 39 ms
61,292 KB
testcase_32 AC 40 ms
62,320 KB
testcase_33 AC 40 ms
62,444 KB
testcase_34 AC 53 ms
75,904 KB
testcase_35 AC 43 ms
67,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

2進数表記に 1010を含む


"""

N = int(input())

mod = 10**9+7

dp = [1,0,0,0]

for i in range(N):

    ndp = [0,0,0,0]

    #ok
    ndp[1] += dp[0] #1を置く
    ndp[0] += dp[0] #0

    #1
    ndp[1] += dp[1] #1を置く
    ndp[2] += dp[1] #0

    #2 = 10
    ndp[3] += dp[2] #1
    ndp[0] += dp[2] #0

    #3 = 101
    ndp[1] += dp[3] #1
    #0は禁止

    for j in range(4):
        ndp[j] %= mod
    dp = ndp

ng = sum(dp) % mod

ans = pow(2,N,mod) - ng
print (ans % mod)
0