結果
問題 | No.2017 Mod7 Parade |
ユーザー | 👑 rin204 |
提出日時 | 2022-07-22 21:43:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 446 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 86,700 KB |
実行使用メモリ | 78,860 KB |
最終ジャッジ日時 | 2023-09-17 09:27:09 |
合計ジャッジ時間 | 4,294 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,396 KB |
testcase_01 | AC | 69 ms
71,032 KB |
testcase_02 | AC | 72 ms
71,248 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 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 73 ms
71,268 KB |
ソースコード
MOD = 998244353 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)