結果

問題 No.2017 Mod7 Parade
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-07-22 22:43:55
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 88,200 KB
最終ジャッジ日時 2023-09-17 11:16:13
合計ジャッジ時間 5,760 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,392 KB
testcase_01 AC 74 ms
71,512 KB
testcase_02 AC 72 ms
71,032 KB
testcase_03 AC 244 ms
85,840 KB
testcase_04 AC 194 ms
82,940 KB
testcase_05 AC 171 ms
81,956 KB
testcase_06 AC 250 ms
86,708 KB
testcase_07 AC 122 ms
78,416 KB
testcase_08 AC 184 ms
82,180 KB
testcase_09 AC 138 ms
79,544 KB
testcase_10 AC 186 ms
82,080 KB
testcase_11 AC 222 ms
84,688 KB
testcase_12 AC 207 ms
83,932 KB
testcase_13 AC 273 ms
88,124 KB
testcase_14 AC 272 ms
88,080 KB
testcase_15 AC 273 ms
88,132 KB
testcase_16 AC 272 ms
88,200 KB
testcase_17 AC 274 ms
88,180 KB
testcase_18 AC 266 ms
87,996 KB
testcase_19 AC 202 ms
88,108 KB
testcase_20 AC 73 ms
71,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k = int(input())
DL = [list(map(int,input().split())) for i in range(k)]
mod = 10**9+7

ans = 0

dp = [0]*7

for d,l in DL:

    p7 = pow(10,l,7)
    ndp = [0]*7

    ad = d*(p7-1)*4%7
    ans += ad
    ans %= mod
    ndp[ad] += 1
    for i in range(7):
        if dp[i]:
            nad = (i*p7+ad)%7
            ans += dp[i]*nad
            ans %= mod
            ndp[nad] += dp[i]
            ndp[nad] %= mod
            ndp[i] += dp[i]
            ndp[i] %= mod
    dp = ndp
print(ans)
0