結果

問題 No.2017 Mod7 Parade
ユーザー 👑 rin204rin204
提出日時 2022-07-22 21:44:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 78,696 KB
最終ジャッジ日時 2023-09-17 09:27:40
合計ジャッジ時間 4,461 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
70,940 KB
testcase_01 AC 75 ms
71,024 KB
testcase_02 AC 79 ms
70,948 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 154 ms
76,868 KB
testcase_19 AC 141 ms
76,868 KB
testcase_20 AC 73 ms
70,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

k = int(input())
dp = [0] * 7
dp[0] = 1
for _ in range(k):
    d, l = map(int, input().split())
    l %= 6
    if l == 0:
        continue
    times = pow(10, l, 7)
    plus = 0
    for _ in range(l):
        plus += d
        d *= 10
    plus %= 7
    ndp = dp[:]
    for i in range(7):
        ndp[(i * times + plus) % 7] += dp[i]
        ndp[i] %= MOD
    dp = ndp
ans = sum(i * d for i, d in enumerate(dp))
print(ans % MOD)

0