結果

問題 No.2017 Mod7 Parade
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-07-30 19:03:47
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 604 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 86,632 KB
実行使用メモリ 92,044 KB
最終ジャッジ日時 2023-09-27 20:48:04
合計ジャッジ時間 7,965 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,280 KB
testcase_01 AC 69 ms
71,292 KB
testcase_02 AC 69 ms
71,248 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 499 ms
89,476 KB
testcase_19 AC 485 ms
89,412 KB
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

k = int(input())
dl = []
for i in range(k):
    dl.append(tuple(map(int,input().split())))
dp = [[0] * 7 for _ in range(6)]
dp[0][0] = 1
mod = 10 ** 9 + 7
for d,l in dl[::-1]:
    n_dp = [[0] * 7 for _ in range(6)]
    p = (l%6)
    val = int((str(d) * p)) % 7
    for i in range(6):
        for j in range(7):
            n_dp[i][j] += dp[i][j]
            val2 = (pow(10,i,7)*val) % 7
            n_dp[(i+p)%6][(j+val2)%7] += dp[i][j]
            n_dp[(i+p)%6][(j+val2)%7] %= mod
    dp = n_dp
ans = 0

for i in range(6):
    for j in range(7):
        ans += j * dp[i][j]
        ans %= mod
print(ans)
0