結果

問題 No.2017 Mod7 Parade
ユーザー asumo0729asumo0729
提出日時 2022-07-22 21:50:30
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,239 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 90,656 KB
最終ジャッジ日時 2023-09-17 09:41:35
合計ジャッジ時間 5,923 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
72,600 KB
testcase_01 AC 111 ms
72,336 KB
testcase_02 AC 109 ms
72,524 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 355 ms
88,996 KB
testcase_19 AC 216 ms
89,240 KB
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
from collections import defaultdict, deque
import heapq
from heapq import heapify, heappop, _heapify_max, heappush
from bisect import bisect_left, bisect_right
import math
import itertools
import copy

stdin=sys.stdin
#sys.setrecursionlimit(10 ** 7)
## import pypyjit
## pypyjit.set_param('max_unroll_recursion=-1')

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
inf = float('inf')
mod = 10 ** 9 + 7
#mod = 998244353
eps = 1e-9
sortkey1 = itemgetter(0)
sortkey2 = lambda x: (x[0], x[1])



###############################################################

K = ip()
DL = [lp() for _ in range(K)]
dp = [0 for _ in range(7)]
dp[0] = 1
for d, l in DL:
    prev = dp
    dp = [0 for _ in range(7)]
    for i in range(7):
        dp[i] += prev[i]
        dp[i] %= mod

    ten = pow(10, l, 7)
    p, q = divmod(l, 6)
    x = int(str(d) * q) % 7
    x = x * pow(10, 6 * p, 7)
    x %= 7
    for i in range(7):
        j = (i * ten + x) % 7
        dp[j] += prev[i]
        dp[j] %= mod

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